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
Post a Comment