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. 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
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 -- 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
Java intercept backslash ReplaceAll and split ("\") Problem resolutionXxx.split ("\ \") is obviously not getting the results you want.Correct methodXxx.split ("\\\\");The reasons are as follows:In Java to deal with some path-related problems, such
Split method: splits a string into substrings and returns the result as an array of strings. Stringobj.split ([Separator],[limit])Parameters: Stringobj required option. the String object or text to be decomposed . The object is not modified by the
Use split and split
Java. lang. string. splitSplit MethodSplits a string into substrings and returns the result as a string array.StringObj. split ([separator, [limit])StringObjRequired. The String object or text to be decomposed. The object is not
Java class, split with "," to convert a string to an arrayString str = "A,b,c,";string[] arr = Str.split (",");System.out.println (arr.length);The output length is 3,arr[0]= "a"; Arr[1]= "B"; Arr[2]= "C";JS, to "," split, the string is converted to
The following example illustrates the outofmemoryerror caused by the string substring method:
[Java] view plaincopyprint? Public class testgc {Private string large = new string (New char [2, 100000]);Public String getsubstring (){Return this. Large.
Given an array with n integers, you need to find if there is triplets (I, J, K) which satisfies following conditions:
0
Sum of Subarrays (0, i-1), (i + 1, j-1), (j + 1, k-1) and (k + 1, n-1) should be equal.
Where we define that
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.