Loading ...

How to replace all the blank spaces in Javascript

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  client side web development   » How to replace all the blank spaces in Javascript

How to replace all the blank spaces in Javascript

Posts under the topic: How to replace all the blank spaces in Javascript

Posted: 5/23/2010

Lurker 235  points  Lurker
  • Joined on: 10/16/2009
  • Posts: 47

Hi experts,

I have a string in jabvascript . There is a requirement to replace all the blank spaces with a particular character . How can I do so ?


tags javascript

Posted: 6/2/2010

Lurker 270  points  Lurker
  • Joined on: 1/3/2009
  • Posts: 14
  Answered

using replace  with regular expression you can do this.

 

var replaceText = "_";
var OutPut= " this is only for testing ";
OutPut= OutPut.replace(/\s+/g, replaceText);



Page 1 of 1 (2 items)