cancel
Showing results for 
Search instead for 
Did you mean: 

UDF to Strip Non Numeric characters

Former Member
0 Kudos

Hi experts,

Can anyone help me with an UDF which strips non numeric characters.

Example: 123-456.789

output should be :  123456789

Regards,

Mastan vali

Accepted Solutions (1)

Accepted Solutions (1)

manoj_khavatkopp
Active Contributor
0 Kudos

hi Mastan,

try these. (take inp as input type string)

String str= null;

str = inp.replaceAll("\\D+","");

return str;

Regards,

Manoj

diego_gabriel
Participant
0 Kudos

Hi Mastan,

Another regular expression could be

s.replaceAll("[^0-9]", "");

where 's' is your input string.

Regards,

Diego

Former Member
0 Kudos

it worked.....Thank you Manoj

Answers (1)

Answers (1)

former_member186851
Active Contributor
0 Kudos

Hello Mastan,

Try the below code

input.replaceAll("[^0-9]", "");