Possible Duplicate:
How to replace all points in a string in JavaScript
I am trying to remove '.'(dot) symbol from my string. and The code that Ive used is
checkedNew = checked.replace('.', "");
Bt when I try to alert the value of checkedNew, for example if the checkedNew has original value U.S. Marshal, the output that I get is US. Marshal, it will not remove the second dot in that string. How do remove all dot symbols?
One of the easiest ways to remove punctuation from a string in Python is to use the str. translate() method.
Split the string on all the .
's and then join it again with empty spaces, like this:
checkedNew = checked.split('.').join("");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With