I have a String that looks like this
The#red#studio#502#4
I need to split it into 3 different Strings in the array to be
s[0] = "The red studio"
s[1] = "502"
s[2] = "4"
The problem is the first one should have only words and the second and third should have only numbers...
I was trying to play with the s.split() Method, but no luck.
String s= "The#red#studio#502#4";
String[] array = s.split("#(?=[0-9])");
for(String str : array)
{
System.out.println(str.replace('#',' '));
}
Output:
The red studio
502
4
Ideone link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With