javascript - numeric/string to only numeric -


in javascript, how transform "numeric/string" variable numeric? using function or regular expression.?

sample: input: 11.489.301/0001-47 to: 11489301000147

use replace() remove non-numeric characters, , number() convert string type number type:

var num = number("11.489.301/0001-47".replace(/\d/g, ""));  alert(num); //-> 11489301000147 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -