測試的時候遇到一個問題:
<c:out value="${fn:endsWith('helle','e') }"></c:out>
<c:out value="${fn:endsWith('hhlle','e') }"></c:out>
訪問的時候顯示 false true 。 為什么啊?。????
<c:out value="${fn:endsWith('helle','e') }"></c:out>
<c:out value="${fn:endsWith('hhlle','e') }"></c:out>
訪問的時候顯示 false true 。 為什么啊?。????
2016-10-04
已采納回答 / 蝸牛__
public static boolean endsWith(String input, String substring) { ? ?if(input == null) { ? ? ? ?input = ""; ? ?} ? ?if(substring == null) { ? ? ? ?substring = ""; ? ?} ? ?int index = input.indexOf(substring); ? ?return index == -1?false:(index == 0 &&a...
2016-10-04
EL的運算符,EL的“+”運算符和Java中的“+”運算符不一樣,它不能實現兩個字符串的鏈接,如果這兩個字符串是不能轉化為數值型的字符串,就將拋出異常,這是老師沒有講的。如果要使用兩個字符串連接(拼接)的話就要${表達式}${表達式}連接不需要“+”符號。
2016-09-22