javascript - ReplaceAll Google script -
i've got problem, trying use replace function in javascript , cannot work. i'm using:
var pagename = projectname.replace (" ", "");
but takes first space, wanted take spaces. example:
"my first project 1" = "myfirstproject1", ie together.
i'm developing script of google apps.
thank you.
you should try :
var pagename = projectname.replace (/\s/g, '');
the g
@ end of regular expression, flag indicating replace method shouldn't replace first occurrence of space character.
Comments
Post a Comment