Membership Membership:
Latest New User Latest: vpros
Past 24 Hours Past 24 Hours: 0
Prev. 24 Hours Prev. 24 Hours: 0
User Count Overall: 137

People Online People Online:
Visitors Visitors: 7
Members Members: 0
Total Total: 7

NakedMCSE Computer Tech Support Forums

So you have passed all of the exams and you are now out in the real world of windows servers, linux servers and freebsd servers faced with a tech support problem you have never seen before...

Find free online tech support in the forums below, respecting that advice is free, but work beyond advice is not...

The General forum is provided for off topic discussion.

You need a user account to post - please Register or Login.

Online Tech Support Forums
  Forum  Discussions  General  Stripping or replacing characters with Javascript
Previous Previous
Next Next
New Post 4/15/2011 2:54 PM
119 posts
10th Level Poster

Stripping or replacing characters with Javascript 

To strip characters out of a string or replace characters with a different character in javascript, you can use 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('');


Previous Previous
Next Next
  Forum  Discussions  General  Stripping or replacing characters with Javascript
Send me One Million FREE Guaranteed Visitors