在站长之家用网页转,是能转出来,用代码怎么实现?
require "cgi" CGI.unescape_html("map") # => "map"
https://ruby-doc.org/stdlib-3.0.0/libdoc/cgi/rdoc/CGI/Util.html#method-i-unescape_html
先谢谢,不过我是要获取明文字符串"map"转换之后的结果
https://github.com/threedaymonk/htmlentities
s = "map" info = "" for i in 0..s.size-1 info += "&##{u.ord.to_s};" end
硬编,直接拿 asscii 组
irb(main):001:0> 'map'.codepoints => [109, 97, 112]
@huacnlee 楼层数不太对