Ron Arel
Ron Arel

Reputation: 101

Formatting Phone Numbers?

If I have these phone numbers taken from my contacts in Android-Studio:

+1(354)434-777

+1444555666

I want to format them into:

354434777

444555666

How can I do this in Android-Studio/Java Automatically?

Upvotes: 0

Views: 263

Answers (1)

Navneet Krishna
Navneet Krishna

Reputation: 5017

Try replace()

 String number = String.valueOf(your_number.replace("+1", "").replace("(", "").replace(")", "").replace("-", "");

Upvotes: 1

Related Questions