tokhi tokhi - 1 year ago 80
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 Source

Use CGI library from ruby

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