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

c# - OpenXML hanging while writing elements -

php - regexp cyrillic filename not matches -

sql - Select Query has unexpected multiple records (MS Access) -