From: Mike Stok Date: 2001-08-17T08:30:27+09:00 Subject: [ruby-talk:19925] Re: efficent way to split up arguments of a string On Fri, 17 Aug 2001, Jonathan Brannan wrote: > Ive been reading in a file and need to split the first word and the rest of > the arguments. > Right now im using line.split[1..-1].join(" ") to get the args back as a > string, was just wondering if there was a better way. You can ask split to just split it into 2 pieces e.g. irb(main):001:0> s = 'command and some args' "command and some args" irb(main):002:0> c, a = s.split(' ', 2) ["command", "and some args"] Hope this helps, Mike -- mike@stok.co.uk | The "`Stok' disclaimers" apply. http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA | Fingerprint 0570 71CD 6790 7C28 3D60 | 75D2 9EC4 C1C0 0599 13DA