
If you need to strip all non-numeric characters from a string (except for the period character) using JavaScript, try:
string.replace(/[^\d.]/g, "");
This function is handy when validating input
If you need to strip all non-numeric characters from a string (except for the period character) using JavaScript, try:
string.replace(/[^\d.]/g, "");
More posts tagged:
code / javascript / Programming
More posts categorized:
asides Programming