From: Li Chen Date: 2008-09-25T23:05:27+09:00 Subject: how to wrap a long string Hi all, I need to wrap a long string into several small segments. I search the forum and see a few solutions for that. I copy one script and run it on my Vista(with very small change) and here are the output: C:\Documents and Settings\chen73>irb irb(main):001:0> text = 'aaaaa11111AAAAA22222BBBBB' => "aaaaa11111AAAAA22222BBBBB" irb(main):002:0> 0.step(text.length, 5) {|x| puts text[x, x+5]} aaaaa 11111AAAAA AAAAA22222BBBBB 22222BBBBB BBBBB => 0 It looks like the script really wraps the string. But it also repeats printing out some stuff, such two times of 'AAAAA', '22222', 3 times of 'BBBBB'. Is it possible to get the output as follows: aaaaa 11111 AAAAA 22222 BBBBB Thanks, Li -- Posted via http://www.ruby-forum.com/.