user1284567
user1284567

Reputation: 141

How to use Regex to show numbers ? (Android)

I have this line:

stringer = str.replaceAll("[\\P{L}\\p{N}\\p{Latin}/u]", " "); 

It replaces all Latin chars with space (" ") but it also replaces numeric symbols

And I don't want it to replace numeric symbols , what do I need to change in this line to make it work?

Upvotes: 0

Views: 123

Answers (2)

tweak2
tweak2

Reputation: 656

You might want to have a look at the built in android normalizer which will convert them to their non-latin version.

http://developer.android.com/reference/java/text/Normalizer.html

Upvotes: 0

Hakan Serce
Hakan Serce

Reputation: 11256

The following should work:

stringer = str.replaceAll("[\\P{L}\\p{N}\\p{Latin}/u&&[^\\d]]", " ");

Upvotes: 2

Related Questions