I have a string of the following form :
"(number) number"
So for example it may contain :
5 (5)
or
5 (3)
I wish to create an int variable which will hold the first value (in both cases 5), and a second int variable which will hold the value in the brackets (5 in the first case, 3 in the second).
What is the best way for me to parse this string and save the info in the variables as I wish?
test link: http://ideone.com/PzidT
If you are not sure that input has exactly two numbers, then safer code is:
test link: http://ideone.com/dBIjh