Hi, just knew that the [0] can return the ascii code : e.g. : "A"[0] >> 65 So, the method is :
def to_h(string) saida="" string.each_char do |charac| saida = saida+ "&#"+charac[0].to_s end return saida end
Hi, just knew that the [0] can return the ascii code : e.g. : "A"[0] >> 65 So, the method is :
def to_h(string) saida="" string.each_char do |charac| saida = saida+ "&#"+charac[0].to_s end return saida end