我一直收到这个错误,但我相信我正在尝试比较两个字符串...我错过了什么吗?
<link data-require="fontawesome@4.5.0" data-semver="4.5.0" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="http://momentjs.com/downloads/moment.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<!DOCTYPE html>
<html lang="en" ng-app="customcal">
<head>
<meta charset="utf-8" />
<title>AngularJS Custom Calendar</title>
<link data-require="fontawesome@4.5.0" data-semver="4.5.0" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.css" />
<style>
label {
display: block;
}
</style>
</head>
<body>
<div class="cal-wrapper">
<div class="custom-calendar-wrapper" ng-controller="customCal">
<div class="selected-date" ng-bind="setSelDate"></div>
<div class="cc-header">
<div class="cc-year-header">
<span class="cc-nav-left cc-nav">
<i class="fa fa-chevron-left"></i>
</span>
<span class="cc-year" ng-bind="year"></span>
<span class="cc-nav-right cc-nav">
<i class="fa fa-chevron-right"></i>
</span>
<span class="cc-year-header-today">Today</span>
</div>
<div class="cc-month-header">
<span class="cc-month" ng-class="{ 'msel' : month == today.m }" ng-repeat="month in months track by $index" ng-bind="month" ng-click="changeMonth(this, month, year);"></span>
</div>
</div>
<ul class="cc-week">
<li ng-repeat="week in weeks" ng-bind="week"></li>
</ul>
<ul class="cc-dates">
<li class="cc-dt" ng-class="{ 'cc-today' : dt == today.d && month == today.m && year == today.y }" ng-click="changeDate(this, dt, month, year);" ng-repeat="dt in daysofmonth track by $index" ng-bind="dt"></li>
</ul>
</div>
</div>
</body>
</html>
我试图将它们转换为Ints,但这没有帮助。任何建议将不胜感激!
答案 0 :(得分:1)
使用compareTo方法。 http://docs.oracle.com/javase/8/docs/api/java/lang/String.html#compareTo-java.lang.String-
这将返回一个int,如果接收者小于参数,则为负。
if (classVolume.compareTo(rs.getString("class_size")) >= 0) ...