1.

How Can You Split A String In Java?

Answer»

String provides a split METHOD in order to split the string into one or more SUBSTRING based on the given regular EXPRESSION.

As example If you have a string where one (or more) SPACES are USED and you want to split it around those spaces.

String str1 = "split example program";
String[] strArray = str1.split("\s+");

String provides a split method in order to split the string into one or more substring based on the given regular expression.

As example If you have a string where one (or more) spaces are used and you want to split it around those spaces.

String str1 = "split example program";
String[] strArray = str1.split("\s+");



Discussion

No Comment Found