I have string like this String s="ram123",d="ram varma656887"
I want string like ram and ram varma so how to seperate string from combined string
I am trying using regex but it is not working
PersonName.setText(cursor.getString(cursor.getColumnIndex(cursor
.getColumnName(1))).replaceAll("[^0-9]+"));
The correct RegEx for selecting all numbers would be just [0-9]
, you can skip the +
, since you use replaceAll
.
However, your usage of replaceAll
is wrong, it's defined as follows: replaceAll(String regex, String replacement)
. The correct code in your example would be: replaceAll("[0-9]", "")
.
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