how to read digits in a number

P

Pepe Sanchez

Hi all

I would like to read all the characters in a string. For example
"123456" I need to read every digit separately.

thanks
 
J

Josef 'Jupp' Schugt

I would like to read all the characters in a string. For example
"123456" I need to read every digit separately.

For strings use

"123456".split(//)

for integers

"123456".split(//).map{|x| x.to_i}

HTH,

Josef 'Jupp' Schugt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,201
Messages
2,571,049
Members
47,655
Latest member
eizareri

Latest Threads

Top