å¯ä»¥æªåï¼ç¨fnå½æ°ï¼
ä¸é¢æ¯JSTLä¸èªå¸¦çæ¹æ³å表以åå
¶æè¿°
å½æ°å å½æ°è¯´æ 使ç¨ä¸¾ä¾
fn:contains å¤æå符串æ¯å¦å
å«å¦å¤ä¸ä¸ªå符串 <c:if test="${fn:contains(name, searchString)}">
fn:containsIgnoreCase å¤æå符串æ¯å¦å
å«å¦å¤ä¸ä¸ªå符串(大å°åæ å
³) <c:if test="${fn:containsIgnoreCase(name, searchString)}">
fn:endsWith å¤æå符串æ¯å¦ä»¥å¦å¤å符串ç»æ <c:if test="${fn:endsWith(filename, ".txt")}">
fn:escapeXml æä¸äºå符转æXML表示ï¼ä¾å¦ <å符åºè¯¥è½¬ä¸º< ${fn:escapeXml(param:info)}
fn:indexOf åå符串å¨æ¯å符串ä¸åºç°çä½ç½® ${fn:indexOf(name, "-")}
fn:join å°æ°ç»ä¸çæ°æ®èåæä¸ä¸ªæ°å符串ï¼å¹¶ä½¿ç¨æå®åç¬¦æ ¼å¼ ${fn:join(array, ";")}
fn:length è·åå符串çé¿åº¦ï¼æè
æ°ç»çå¤§å° ${fn:length(shoppingCart.products)}
fn:replace æ¿æ¢å符串ä¸æå®çå符 ${fn:replace(text, "-", "")}
fn:split æå符串æç
§æå®å符åå ${fn:split(customerNames, ";")}
fn:startsWith å¤æå符串æ¯å¦ä»¥æ个å串å¼å§ <c:if test="${fn:startsWith(product.id, "100-")}">
fn:substring è·åå串 ${fn:substring(zip, 6, -1)}
fn:substringAfter è·åä»æ个å符æå¨ä½ç½®å¼å§çå串
${fn:substringAfter(zip, "-")}
fn:substringBefore è·åä»å¼å§å°æ个å符æå¨ä½ç½®çå串 ${fn:substringBefore(zip, "-")}
fn:toLowerCase 转为å°å ${fn.toLowerCase(product.name)}
fn:toUpperCase 转为大åå符 ${fn.UpperCase(product.name)}
fn:trim å»é¤å符串ååçç©ºæ ¼ ${fn.trim(name)}
å½æ°
æè¿°
fn:contains(string, substring)
å¦æåæ°stringä¸å
å«åæ°substringï¼è¿åtrue
fn:containsIgnoreCase(string, substring)
å¦æåæ°stringä¸å
å«åæ°substringï¼å¿½ç¥å¤§å°åï¼ï¼è¿åtrue
fn:endsWith(string, suffix)
å¦æåæ° string 以åæ°suffixç»å°¾ï¼è¿åtrue
fn:escapeXml(string)
å°æç¹æ®æä¹çXML (åHTML)转æ¢ä¸ºå¯¹åºçXML character entity codeï¼å¹¶è¿å
fn:indexOf(string, substring)
è¿ååæ°substringå¨åæ°stringä¸ç¬¬ä¸æ¬¡åºç°çä½ç½®
fn:join(array, separator)
å°ä¸ä¸ªç»å®çæ°ç»arrayç¨ç»å®çé´é符separator串å¨ä¸èµ·ï¼ç»æä¸ä¸ªæ°çå符串并è¿åã
fn:length(item)
è¿ååæ°itemä¸å
å«å
ç´ çæ°éãåæ°Itemç±»åæ¯æ°ç»ãcollectionæè
Stringãå¦ææ¯Stringç±»å,è¿åå¼æ¯Stringä¸çå符æ°ã
fn:replace(string, before, after)
è¿åä¸ä¸ªString对象ãç¨åæ°afterå符串æ¿æ¢åæ°stringä¸ææåºç°åæ°beforeå符串çå°æ¹ï¼å¹¶è¿åæ¿æ¢åçç»æ
fn:split(string, separator)
è¿åä¸ä¸ªæ°ç»ï¼ä»¥åæ°separator 为åå²ç¬¦åå²åæ°stringï¼åå²åçæ¯ä¸é¨åå°±æ¯æ°ç»çä¸ä¸ªå
ç´
fn:startsWith(string, prefix)
å¦æåæ°string以åæ°prefixå¼å¤´ï¼è¿åtrue
fn:substring(string, begin, end)
è¿ååæ°stringé¨åå符串, ä»åæ°beginå¼å§å°åæ°endä½ç½®ï¼å
æ¬endä½ç½®çå符
fn:substringAfter(string, substring)
è¿ååæ°substringå¨åæ°stringä¸åé¢çé£ä¸é¨åå符串
fn:substringBefore(string, substring)
è¿ååæ°substringå¨åæ°stringä¸åé¢çé£ä¸é¨åå符串
fn:toLowerCase(string)
å°åæ°stringææçå符å为å°åï¼å¹¶å°å
¶è¿å
fn:toUpperCase(string)
å°åæ°stringææçå符å为大åï¼å¹¶å°å
¶è¿å
fn:trim(string)
å»é¤åæ°string é¦å°¾çç©ºæ ¼ï¼å¹¶å°å
¶è¿å
温馨提示:答案为网友推荐,仅供参考