What is the shortest way to convert this string to an array in Ruby? Thank you. | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 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 Antwort
+ 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