"guid is: ": 956abcdefg25687qwe: true
I want to split 956abcdefg25687qwe and store it in a variable?
"guid is: ": 956abcdefg25687qwe: true
I want to split 956abcdefg25687qwe and store it in a variable?
I am not sure about what you want but you can use regular expressions with replaceAll
method, like that:
String str = "956abcdefg25687qwe";
String str2 = str.replaceAll("[0-9]","");
String str3 = str.replaceAll("[^A-Za-z]","");
System.out.println(str); // 956abcdefg25687qwe
System.out.println(str2); // abcdefgqwe
System.out.println(str3); // 95625687
Not sure what you mean, but I guess you want to use the split method from the String class: Java 7 String.split.