JSTL fn:split()函數

來源:互聯網
上載者:User

標籤:

jstl fn:split()函數代碼和用法 -使用fn:split() 函數將一個字串到一個數組根據分隔字元字串的子字串。

使用fn:split() 函數將一個字串到一個數組根據分隔字元字串的子字串。

文法:

 fn:split() 使用的文法如下:

java.lang.String[] split(java.lang.String, java.lang.String)
例子:

以下的例子來說明這個函數的功能:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><%@ taglib uri="http://java.sun.com/jsp/jstl/functions"                                                   prefix="fn" %><html><head><title>Using JSTL Functions-www.yiibai.com</title></head><body><c:set var="string1" value="This is first String."/><c:set var="string2" value="${fn:split(string1, ‘ ‘)}" /><c:set var="string3" value="${fn:join(string2, ‘-‘)}" /><p>String (3) : ${string3}</p><c:set var="string4" value="${fn:split(string3, ‘-‘)}" /><c:set var="string5" value="${fn:join(string4, ‘ ‘)}" /><p>String (5) : ${string5}</p></body></html>

這將產生以下結果:

String (3) : This-is-first-String.String (5) : This is first String.

 

JSTL fn:split()函數

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.