Hi
How can i parse arguments separated by comma in ruby?
For example:
$> Main.rb --xmlid 1,2,3,4,5
I want to parse and store 1,2,3,4,5 in an array.
How can I do that?
Thanks.
Hi
How can i parse arguments separated by comma in ruby?
For example:
$> Main.rb --xmlid 1,2,3,4,5
I want to parse and store 1,2,3,4,5 in an array.
How can I do that?
Thanks.
Once you know the index in ARGV
of the list (in this case 1), use:
ARGV[index].split(',') #=> ["1", "2", "3", "4", "5"]