From: yvon.thoravalNO-SPAM@... (Yvon Thoraval) Date: 2004-03-31T20:14:26+09:00 Subject: Re: [newbie] prob with join "/" Robert Klemme wrote: > The error is easily explained by the behavior of split: > > irb(main):010:0> ar = "/foo/bar".split '/' > => ["", "foo", "bar"] > irb(main):011:0> ar.join '/' > => "/foo/bar" > > Note the empty element at the beginning. compact() doesn't change that > since it removes only nils: > > irb(main):013:0> ar = "/foo/bar".split( '/' ).compact > => ["", "foo", "bar"] > irb(main):014:0> ar.join '/' > => "/foo/bar" > > However, File.split and File.join are used much easier and I guess they > are more appropriate in your case. ok, tanxs, however my pathes are comin' from java-side (i'm using JRuby), the reason i didn't make use of File.[split|join], i've changed #compact to #delete("") and works fine -- yt