How do I remove a non-breaking space in Ruby

In case you do not care about the non-breaking space specifically, but about any “special” unicode whitespace character that might appear in your string, you can replace it using the POSIX bracket expression for whitespace:

s.gsub(/[[:space:]]/, '')

These bracket expressions (as opposed to matchers like \s) do not only match ASCII characters, but all unicode characters of a class.

For more details see the ruby documentation

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)