Are you receiving a string (NULL terminated array of chars) or a String (a String object) ?
If the former then look at the strtok() function to split the string at the commas then you can manipulate the data in the resulting strings to get what you want.