Mega Code Archive

 
Categories / Java / Data Type
 

Using second argument in the String split() method to control the maximum number of substrings generated by splitting a string.t

public class Main {   public static void main(String args[]) {     String[] temp = "A.B.BB".split("\\.", 2);     for (String s: temp){       System.out.println(s);     }   } }