JS,JAVA,JSTL multi-delimiter split string

Source: Internet
Author: User

1. JS multi-delimiter split string

var username = "Zhao,li;wang, Liu";

var arr = str.split (/; |;|,|,|,/); The parentheses can be used to write multi-split symbols, both in English and Chinese, and note that the "|" Between each separator Separated, if it is a special split symbol, such as a dot, plus sign, must be denoted with an escape character such as Str.split (".") should be written as str.split ([.]);

2, Java Multi-delimiter split string

string[] name = Str.split ("; |;|,|,");

3, the JSTL tag has a parameter specifically configured for direct use of separators

<c:fortokens items= "${reslist.metamap[' keywords ']}" delims= ";;,," var= "Singlekeyword" >
<a href= "Javascript:searchbycase (' ${singlekeyword} ', ')" Title= "${singlekeyword}" >${singlekeyword}</a >
</c:forTokens>

From: http://blog.sina.com.cn/s/blog_67b9ad8d01019g1h.html

JS,JAVA,JSTL multi-delimiter split string

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.