I have
String s = "hello=goodmorning,2,1"
can somebody help me with the code on how to split s to equal the following:
String s2 = "hello" String s3 = "goodmorning" string s4 = "2,1" I have
String s = "hello=goodmorning,2,1"
can somebody help me with the code on how to split s to equal the following:
String s2 = "hello" String s3 = "goodmorning" string s4 = "2,1" String s = "hello=goodmorning,2,1" String[] str = s.split("="); //now str[0] is "hello" and str[1] is "goodmorning,2,1" String str1 = str[0]; //hello String[] str2 = str[1].split(","); //now str2[0] is "goodmorning" and str2[1] is "2,1" String str3 = str2[0]; //goodmorning String str4 = str2[1]; //2,1 Output:
str1 = hello; str3 = goodmorning; str4 = 2,1;