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
Post a Comment