How do I create spaces between every four integers in Ruby?

Posted by Trip on Stack Overflow See other posts from Stack Overflow or by Trip
Published on 2010-06-16T12:43:55Z Indexed on 2010/06/16 12:52 UTC
Read the original article Hit count: 142

Filed under:
|

I am trying to take the following number:

423523420987

And convert it to this:

4235 2342 0987

It doesn't necessarily have to be an integer either. In fact, I would prefer it to be a string.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby