I want to replace all occurrences of white space characters (space, tab, newline) in JavaScript. How to do so?
I tried:
str.replace(/ /gi, \"X\
Actually it has been worked but
just try this.
take the value /\s/g into a string variable like
String a = /\s/g; str = str.replaceAll(a,"X");