Check out sscanf, be sure to read the user submitted comments though too. You can find a better description of the formats allowed at http://www.cplusplus.com/reference/clibrary/cstdio/scanf/.
string(2) "AB"
[1]=>
int(1234)
[2]=>
string(19) "Hello, how are you?"
}
*/