For an input like 12,34,56;78,91;50,60;
I want to split the string by semi-colon delimit and then those strings split by comma delimit
ex:
puts "Input: "
input = gets.chomp
s_array = input.split(";")
for i in 0..s_array.size
puts s_array[i].split(",")
end
It will successfully print with puts but after I get an error
undefined method 'split' for nil:NilClass <NoMethodError>
Whats the reason for this error?
"12,34,56;78,91;50,60;".split(/[,;]/) #=> ["12","34","56","78","91","50","60"].