Say I have a string containing numbers and other chars.
I want to reduce the string to numbers only.
F.e. from 23232-2222-d23231 to 23232222223231
Can this be done with string.replace()?
if not, what’s the simplest and shortest way?
10x!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are a bunch of possibilities, from Regular Expressions to handling the text yourself. I’d go for this: