jquery - Javascript remove commas from string -
this question has answer here:
- remove characters string 5 answers
i have below variable in javascript. want remove "comma" sign using jquery /javascript.
var test = ",,2,4,,,3,,3,,," expected output: var test = "2,4,3,3"
please advice
var test = ",,2,4,,,3,,3,,,"; document.write(test.replace(/,+/g,',').replace(/^,|,$/g,''));
replace(/,+/g,',')
- remove multiple comma one.replace(/^,|,$/g,'')
- remove comma @ starting , ending.
Comments
Post a Comment