1. JS multi-delimiter split stringvar 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,
Today, we used the split function in Java to use the "|" As a separator, when the input bar, found an error, this problem should have been encountered long ago, but too long to forget!Online a search, found the answer, this is because split inside
Split is a common function in Java. It split a full string to an array based on Delimeter.For example, Split ' A:b:c ' with ': ' results in [A, B, c]In some scenario, it's better to keep the delimeter instead for discard it while splitting.Here is
Java. Lang. String. Split
Split MethodSplits a string into substrings and returns the result as a string array.
Stringobj. Split ([separator, [limit])
StringobjRequired. String object or text to be decomposed. This object will not be modified by the
Before in the http://shukuiyan.iteye.com/blog/507915 article has already described this problem, but in the last written examination actually met this knowledge point, but also did wrong, embarrassed! The Apprentice is not fine. The topic is
[Switch] experiences in using common Java Methods
Constantly improving ing...
Java. Lang. String split
The string split method is to directly split the string according to the given string, for example
Java code
String value = "a, B, c, d, e ";
Recently in the processing of text strings, no row of data are separated by commas, each field value is usually enclosed in double quotation marks, but some field values also contain commas, and even some fields do not have double quotation marks,
The String.Split () method in Java is quite powerful, but the split () method uses regular expressions, which are relatively slow,In fact, most scenarios do not need to use regular expressions, and below share a method that does not use regular
split () is a string parameter in parentheses, so be sure to conform to this: Split (".") form, that is, the point '. ' Enclose them in double quotation marks """." is already defined as a special character in Java, so you want to use "." In Split ()
split () is a string parameter in parentheses, so be sure to conform to this: Split (".") form, that is, the point '. ' Enclose them in double quotation marks """." is already defined as a special character in Java, so you want to use "." In Split ()
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.