I can't remove whitespaces from a string parsed by Nokogiri

若如初见. 提交于 2019-12-03 07:22:39
toniedzwiedz

strip only removes ASCII whitespace and the character you've got here is a Unicode no-break space.

Removing the character is easy. You can use gsub by providing a regex with the character code: gsub(/\u00a0/, '')

You could also call gsub(/[[:space:]]/, '') to remove all Unicode whitespace. For details, check the documentation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!