I have been looking to figure out a way to do the same on some longer strings with various types of values.
I have been looking into two functions not commonly used on the arduino stuff.
atoi() http://www.cplusplus.com/reference/clibrary/cstdlib/atoi/
sscanf() http://www.cplusplus.com/reference/clibrary/cstdio/sscanf/