s = "[[A, B],[E,R], [E,G]]"
Is there a built-in way to convert this string into an array? (s[][])
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is, but in your case it will assume
A B E R Gto be variables, is this the case?If this is not the case you will need to do some extra formatting with the string.
This will work if the variables
A B E R Gare set:s = eval(s)If the letters need to be strings you will have to do some kind of regexp to replace all occurrences of chars with quoted chars.