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
Java -- String. split () function, javastring. splitIn java doc, there are String [] java. lang. String. split (String regex)
Splits this string around matches of the given regular expression.
This method works as if by invoking the
Use of the split function in Java, the pluplit Function
The split function in Java is used to split a string by a specified character (string) or regular expression, and the result is returned in the form of a string array;For example:String str = "1
How to use the Split function in Java
There are also String.Split () methods in the Java.lang package, similar to. NET, where returns are a character array, but there are a few tricks to use.If executed: "2|33|4". Split ("|")
The result is:
""
2
|
3
Use in common to perl,python,awk,r, although Java,c,c++,vala also learned but do not like, you say how to do.It seems the life of the script.Perl@rray = split/pattern/, STRING, LIMITYou can see that split consists of 2 parts (String,pattern) and an
It is believed that many of the first-line developers have encountered split lines, one of the most common elements of visual design, although simple and easy to draw, but in layout and typesetting often affect the view hierarchy of the important
This split method of the Strig class has been used many times. I have referred to a lot of online materials and summarized it now.1: usage of the second parameter of the split FunctionI saw a problem on the Forum, and then I became interested in
The Split function in Java is used to split a string by a specified character (string) or regular, and the result is returned as an array of strings;For example:String str= "[email protected]";String[] A = Str.split ("@");SYSTEM.OUT.PRINTLN
The Split function in Java is used to segment a string by a specified character (string) or regular, and the result is returned as an array of strings;
For example:
[Java] view plain copy String str= "1234@ABC"; String[] A = Str.split
There is a String.Split () method in the Java.lang package, which returns an arrayI use in the application of some, to summarize for you, for your reference only:1. If you use "." As a separate word, it must be written as follows, String.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.