jstl处理字符串

 

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

页头加: <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

函数名 函数说明 使用举例
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)}

你可能感兴趣的:(join,xml,c)