abrar22
9 years agoFrequent Contributor
Trim Special Characters from Numbers
Hi, I want to remove special characters from number. Can I use replace function ? var Notional= Getter.vGetPropertyVal(WTbx_SingleLegNotional,'Text'); var Desired= Notional.replace(/[!@#$%^...
- 9 years ago
You can try using this:
var Notional= Getter.vGetPropertyVal(WTbx_SingleLegNotional,'Text');
var Desired= Notional.replace(/\D/g, "");This code works as shown below
function ReplaceSpChr(){ var s = "/[!@2#$4%^&1*]0/g00,0"; // Create regular expression pattern. var re = /\D/g; // Use replace var r = s.replace(re, ""); return(r); // Output: 2410000 }