tokhi tokhi - 4 months ago 14
Ruby Question

extract and convert any ascii code from a string

How can I extract the ascii code from a string and then convert it to char?

string = "a – b"


to

a – b

Answer

Use CGI library from ruby

CGI.unescapeHTML("a – b")
#=> "a – b"
Comments