-5

"guid is: ": 956abcdefg25687qwe: true

I want to split 956abcdefg25687qwe and store it in a variable?

nikhil bisht
  • 21
  • 1
  • 3

2 Answers2

1

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
veben
  • 19,637
  • 14
  • 60
  • 80
0

Not sure what you mean, but I guess you want to use the split method from the String class: Java 7 String.split.

Sergio Robles
  • 66
  • 2
  • 6