Java String Split Example
I don't know how many times I need to Split String in Java. Split is very common operation given various data sources e.g CSV file which contains input string in form of large String separated by comma. Splitting is necessary and Java API has great support for it. Java provides two convenience methods to split strings first within the java.lang.String class itself: split (regex) and other in java.util.StringTokenizer. Both are capable to split the string by any delimiter provided to them. Since String is final in Java every split-ed String is a new String in Java.
I don't know how many times I need to Split String in Java. Split is very common operation given various data sources e.g CSV file which contains input string in form of large String separated by comma. Splitting is necessary and Java API has great support for it. Java provides two convenience methods to split strings first within the java.lang.String class itself: split (regex) and other in java.util.StringTokenizer. Both are capable to split the string by any delimiter provided to them. Since String is final in Java every split-ed String is a new String in Java.