M
M
MDtox2018-01-17 10:49:44
ruby
MDtox, 2018-01-17 10:49:44

How to convert a string to hexadecimal system?

I don't get out. Outputs 0 in output

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jj_killer, 2018-01-17
@jj_killer

"string".each_byte.map { |b| b.to_s(16) }.join
# или так
"string".unpack('H*').first

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question