String. Split () Usage

Source: Internet
Author: User
The Java. lang package contains the string. Split () method, and an array is returned.
I have used some of them in the application. I will summarize them for your reference only:
1. If ". ", must be written as follows: string. split ("\\. "), in this way, the correct separation is not allowed using string. split (". ");
2. If "|" is used as the separator, it must be written as follows: string. split ("\ |"), in order to correctly separate, cannot use string. split ("| ");
"." And "|" are escape characters and must be added "\\";
3. If a string contains multiple delimiters, you can use "|" as a hyphen, for example, "acount =? And UU =? Or n = ?", Separate all three,

You can use string. Split ("and | or ");

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.