Vrone said:
Rob said:
On Dec 3, 2008, at 10:12 AM, Vrone Ve wrote:
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
(e-mail address removed)
thanks Rob, and all for your response
My detailed question is regarding a string something like
String "ABC\Name X\Gender "
and I want to scan the string for each of the element(i.e. Name, Gender)
and whereever Name is written in the string, I want to grab the value
placed before the back slash and store it in a variable. same is the
case with gender and/or with any other attribute i want to be in this
string.
Your help required.
cheers