We all know that the split method in the string object is used to split the string according to the matching regular expression.
There are two split Methods
Public String []Split(String RegEx)
The other is: Public String []Split(String RegEx, int limit)
However, in practical applications, we usually use the first one to give a regular expression that separates strings, the function of this method is actually to call the second method by using the given expression and the limit parameter 0.SplitMethod. Therefore, the result array does not contain trailing null strings. In this case, the split string array is often not what we want.
In the second split method, the limit parameter controls the number of times that the mode applies, thus affecting the length of the result array. If this restrictionNIf the value is greater than 0, the mode will be applied to the maximum number of applications.N-Once, the length of the array will not be greaterNAnd the last entry of the array will contain all input that exceeds the last matching delimiter. IfNIf it is not positive, the pattern will be applied as many times as possible, and the array can be of any length. IfNIf the value is 0, the mode will be applied as many times as possible. The array can have any length, and the trailing null string will be discarded.
To sum up, if we use this method to parse a specific string, we 'd better use the second method to set the number of times of the application mode, especially the resolution in the multiple selection box of the Web application, if the application is not blocked, the JSP page may display exceptions.