Javascript Tips and Tricks
Posted
by ybbest
on YBBest
See other posts from YBBest
or by ybbest
Published on Wed, 02 May 2012 03:16:30 +0000
Indexed on
2012/06/22
3:26 UTC
Read the original article
Hit count: 217
sharepoint
1. Replace all , in one Javascript string.
var totalAmount= "100,000,000,000"; var find= ","; //Replace the first , with the empty string var replace=""; totalAmount= totalAmount.replace(find,replace); alert(totalAmount); var totalAmount2= "100,000,000,000"; var newFind=/,/g //Replace all , with empty string totalAmount2= totalAmount2.replace(newFind,replace); alert(totalAmount2);
© YBBest or respective owner