开发者

Rails - Text's double spaces to single space

开发者 https://www.devze.com 2023-03-20 20:18 出处:网络
text_from_db = \"I loveRuby\" When I display this in the view, it shows as \"I love Ruby\". There should be two spaces after the word \'love\'. I\'ve tried si开发者_开发知识库mple_format but it does
text_from_db = "I love  Ruby"

When I display this in the view, it shows as "I love Ruby". There should be two spaces after the word 'love'. I've tried si开发者_开发知识库mple_format but it doesn't seem to work.


This is an HTML question, the clue is that you do see two spaces in the HTML source. All you need to do is make sure that the

white-space: pre;

CSS property is applied to your text, for example by using the <pre> elemeent

0

精彩评论

暂无评论...
验证码 换一张
取 消