What is the shortest way to convert this string to an array in Ruby? Thank you. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the shortest way to convert this string to an array in Ruby? Thank you.

a = "\"[1, 2, 3]\"" #Expected output: # a =[1,2,3]

17th Nov 2017, 3:14 AM
Andy
Andy - avatar
1 Answer
+ 1
Thank you Gordie. Seems that I failed to find a better way from your code :).
17th Nov 2017, 5:52 AM
Andy
Andy - avatar