如何将头发 space ( ) 添加到 gsub 字符串?
How can I add hair space ( ) to gsub string?
我在插件中有以下行来显示我的 Jekyll 网站上的页面浏览量:
html = pv.to_s.reverse.gsub(/...(?=.)/,'\& ').reverse
它在千位之间添加space,例如23 678。
如何在此字符串中添加头发 space  
而不是常规 space?
在HTML中 
就是所谓的decimal numeric character reference:
The ampersand must be followed by a "#" (U+0023) character, followed by one or more ASCII digits, representing a base-ten integer that corresponds to a Unicode code point that is allowed according to the definition below. The digits must then be followed by a ";" (U+003B) character.
Ruby 有 \u
escape sequence. However it expects the following characters to represent a hexadecimal (base-sixteen) integer. That's 200A
。您还必须使用双引号字符串文字,这意味着现在 \
字符需要用另一个字符转义:
"\&\u200A"
或者直接使用它:
'\& '
我在插件中有以下行来显示我的 Jekyll 网站上的页面浏览量:
html = pv.to_s.reverse.gsub(/...(?=.)/,'\& ').reverse
它在千位之间添加space,例如23 678。
如何在此字符串中添加头发 space  
而不是常规 space?
在HTML中 
就是所谓的decimal numeric character reference:
The ampersand must be followed by a "#" (U+0023) character, followed by one or more ASCII digits, representing a base-ten integer that corresponds to a Unicode code point that is allowed according to the definition below. The digits must then be followed by a ";" (U+003B) character.
Ruby 有 \u
escape sequence. However it expects the following characters to represent a hexadecimal (base-sixteen) integer. That's 200A
。您还必须使用双引号字符串文字,这意味着现在 \
字符需要用另一个字符转义:
"\&\u200A"
或者直接使用它:
'\& '