<center>
fn:endsWith()方法判断某字符是否以指定的参数结尾<br>
fn:startsWith()方法判断某字符是否以指定的参数开始<br>
<table>
<c:forEach var="file" items="${files }">
<tr>
<td>${file.name }</td>
<td>
<c:choose>
<c:when test="${fn:startsWith(file.name,'I')}">Intel</c:when>
<c:otherwise>
<c:if test="${fn:endsWith(file.name,'.txt') }">
文本文件
</c:if>
</c:otherwise>
</c:choose>
</c:forEach>
</table>
查找子字符串
fn:indexOf('filename.txt','.')=${fn:indexOf('filename.txt','.') }<br>
字符串分割<br>
<c:set value="${fn:split(header['accept'],',') }" var="names"/>
<c:forEach items="${names }" var="name">
${name }<br>
</c:forEach>
length()方法可取字符串、数组、集合的长度:<br>
"${pageContext.request.requestURL }"的长度:${fn:length(pageContext.request.requestURI) }<br>
</center>
演示效果:
fn:endsWith()方法判断某字符是否以指定的参数结尾
fn:startsWith()方法判断某字符是否以指定的参数开始
$360Section | |
$Recycle.Bin | |
.rnd | |
360SANDBOX | |
BOOTNXT | |
Documents and Settings | |
hiberfil.sys | |
hp | |
inetpub | |
Intel | Intel |
pagefile.sys | |
PerfLogs | |
Program Files | |
Program Files (x86) | |
ProgramData | |
Recovery | |
swapfile.sys | |
SWSetup | |
System Volume Information | |
SYSTEM.SAV | |
Users | |
WiFi_Log.txt | 文本文件 |
Windows | |
查找子字符串 fn:indexOf('filename.txt','.')=8
字符串分割
text/html
application/xhtml+xml
application/xml;q=0.9
image/webp
*/*;q=0.8
length()方法可取字符串、数组、集合的长度:
"http://localhost:8080/ELTest/index3.jsp"的长度:18