Java Pattern split() MethodThe split() method of Pattern class is used to split the given target string according to given pattern. There are two flavors of the split method. The first flavor takes the target string as an argument and has a limit of zero. The second flavor takes two inputs, target string, and limit. The limit parameter controls the number of times the pattern is applied and therefore affects the length ofthe resulting array. This method checks the given regular expression against the input sequence and returns the string array that contains the substrings. SignatureThe split() method is overloaded in the following ways.
Parameterinput - The character sequence to be split. limit - The resulting threshold, as described above. Returns:The array of strings computed by splitting the input around matches of this pattern. Example 1Pattern Split Method in Java regex Example 2Test it NowOutput: Java programming Language
Next TopicJava Regex
|