162
rated 0 times
[
165]
[
3]
/ answers: 1 / hits: 23698
/ 10 Years ago, wed, june 18, 2014, 12:00:00
I have a few strings like so:
str1 = 00001011100000; // 10111
str2 = 00011101000000; // 11101
...
I would like to strip the leading AND closing zeros from every string using regex with ONE operation.
So far I used two different functions but I would like to combine them together:
str.replace(/^0+/,'').replace(/0+$/,'');
More From » jquery