Written by:David Aldridge4/15/2011 2:02 PM
I needed to be able to strip characters out of a string in javascript, so I came up with using the split and join methods:mystring = mystring.split(' ').join(''); This would remove the spaces from the string mystring. This can be combined to remove differing characters - say you wanted to remove spaces and dashes:mystring = (mystring.split(' ').join('')).split('-').join('');
mystring = mystring.split(' ').join('');
mystring = (mystring.split(' ').join('')).split('-').join('');
0 comment(s) so far...