ruby.split(/\n/) separate into multiple array -


i need separate multiple array entries newline. names in aray value. again want split array seperate names.
eg. names="alice\nbob"
, want names=alice&names=bob. how can that??

try this:

names="alice\nbob" names = names.split("\n").map{|item| "names=#{item}"}.join("&") #=> "names=alice&names=bob" 

Comments