Javascript Replace Spaces With One Space

[Solved] Javascript Replace Spaces With One Space | Php - Code Explorer | yomemimo.com
Question : js replace space

Answered by : vastemonde

// replaces space with '_'
str = str.replace(/ /g, "_");
// or
str = str.split(' ').join('_');

Source : | Last Update : Tue, 18 May 21

Question : javascript replace two spaces with one

Answered by : code-grepper

var multiSpacesString="I have some big spaces.";
var singleSpacesString=multiSpacesString.replace(/ +/g, ' ');//"I have some big spaces."

Source : | Last Update : Fri, 09 Aug 19

Question : javascript replace spaces with one space

Answered by : modern-mouse

string = string.replace(/\s\s+/g, ' ');

Source : https://stackoverflow.com/questions/1981349/regex-to-replace-multiple-spaces-with-a-single-space | Last Update : Wed, 11 Aug 21

Question : javascript string spaces replace with %20

Answered by : yog-panjarale

string.replace()

Source : | Last Update : Wed, 16 Dec 20

Answers related to javascript replace spaces with one space

Code Explorer Popular Question For Php