------ art_9364_9586319.1202150971747 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Feb 4, 2008 7:53 AM, SpringFlowers AutumnMoon <summercoolness / gmail.com> wrote: > 7stud -- wrote: > > > class Fixnum > > def a(num) > > return sprintf("%s%s", self, num) > > end > > end > > > > x > > y > > puts x.a(y) > > > > --output:-- > > 34 > > > thanks. or this one works too: > > p (1..10).inject{|x,y| "#{x}#{y}"} > -- > Posted via http://www.ruby-forum.com/. > > I think its better with a .to_a.join, depending on what you want it could be more legible than the .inject one and equally customizable. ------ art_9364_9586319.1202150971747--