I have the following string
myString = "cat(50),dog(60),pig(70)"
I try to convert the above string to 2D array. The result I want to get is
myResult = [['cat', 50], ['dog', 60], ['pig', 70]]
I already know the way to solve by using the legacy string method but it is quite complicated. So I don't want to use this approach.
# Legacy approach
# 1. Split string by ","
# 2. Run loop and split string by "(" => got the <name of animal>
# 3. Got the number by exclude ")".
Any suggestion would appreciate.