Replace white space with AND in ruby -
I'm entering a form with a string input What do I need to do with "AND" Also in place of white space (no quotes). What is the best way to do this?
In addition, how do I do this if I want to remove all white spaces in the string?
Thanks
and to change:
s = 'This is some white space' s.gsub! / \ S + /, 'AND' = & gt; "This and it has some more white space"
To completely remove:
s = 'This is some white space' s. Gsub! / \ S + /, '' = & gt; "IshmoOitesitePass"
Comments
Post a Comment