In between a string escaping comma

test = ‘Foo,Bar Baz’

expected output :
“Foo,Bar”,“Baz”

how can i achieve this

arr = test.split()
arr.to_s

#split takes an argument to specify the delimiter.

"Foo,Bar Baz".split(" ")
# => ["Foo,Bar", "Baz"]

You can also use regular expressions to match more complex delimiters.

Not in this case. Splt has a default arg
split{} is equal to split(" ")

It is very simple to write negative code behind of string and run it