From: Rob Biedenharn Date: 2008-12-04T00:39:41+09:00 Subject: Re: string with \ On Dec 3, 2008, at 10:12 AM, Vrone Ve wrote: > > Hi all > > string = "abc/ def/ ghi/" > > how to get all three of these dynamic values placed before backslash > in > separate variables. > any suggestitons?? > > cheers irb> string = "abc/ def/ ghi/" => "abc/ def/ ghi/" irb> string.split(%r{/\s*}) => ["abc", "def", "ghi"] You could use parallel assignment, but I'd question whether you really wanted three variables rather than a three-element array. a, d, g = string.split(%r{/\s*}) -Rob Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com