jstl處理字串

tonyscau發表於2008-05-12
2007-04-16 08:20

原文地址:http://hi.baidu.com/pistol/blog/item/7b12ceef8cc77e36adafd5ea.html

頁頭加:

函式名函式說明使用舉例
contains判斷字串是否包含另外一個字串
containsIgnoreCase判斷字串是否包含另外一個字串(大小寫無關)
endsWith判斷字串是否以另外字串結束
escapeXml把一些字元轉成XML表示,例如${fn:escapeXml(param:info)}
indexOf子字串在母字串中出現的位置${fn:indexOf(name, "-")}
join將陣列中的資料聯合成一個新字串,並使用指定字元格開${fn:join(array, ";")}
length獲取字串的長度,或者陣列的大小${fn:length(shoppingCart.products)}
replace替換字串中指定的字元${fn:replace(text, "-", "")}
split把字串按照指定字元切分${fn:split(customerNames, ";")}
startsWith判斷字串是否以某個子串開始
substring獲取子串${fn:substring(zip, 6, -1)}
substringAfter

獲取從某個字元所在位置開始的子串

${fn:substringAfter(zip, "-")}
substringBefore獲取從開始到某個字元所在位置的子串${fn:substringBefore(zip, "-")}
toLowerCase轉為小寫${fn.toLowerCase(product.name)}
toUpperCase轉為大寫字元${fn.UpperCase(product.name)}
trim去除字串前後的空格${fn.trim(name)}
[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7558084/viewspace-1003939/,如需轉載,請註明出處,否則將追究法律責任。

相關文章