Rails Strip Method Not Working Correctly -


so in case stumbles across same issue, have string:

a = " string whitespace @ start , end "

interestingly when trying a.strip, string didn't change to:

a = "i string whitespace @ start , end"

the issue here was, had   or other kind of space prevented strip doing best.

my solution, first replace spaces spaces:

a.gsub("\u00a0", " ") (i tried a.gsub(" ", " ") @ first, no luck)

tada!

now got expected a.strip result :)

(maybe there clearer way this, if let me know)


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -