I use this for my own GPS parser. I pulled it off the net or out of a book but can't remember where so I can't give proper credit to its author. You need to declare a char array to hold the GPS data which you probably already have, and then a string array, in this case msg_field[] with enough elements for each field in the char array - a field being the data between the commas. Twenty is sufficient for GPS data.
byte getCSVfields()
{
byte _sentencePos = 0;
byte _comma_count = 0;
msg_field[_comma_count] = "";
while (1)
{
if (input_buffer[_sentencePos] == NULL) break;
if (input_buffer[_sentencePos] == 44)
{
_comma_count++;
msg_field[_comma_count] = "";
_sentencePos++;
}
else
{
msg_field[_comma_count] += input_buffer[_sentencePos];
_sentencePos++;
}
}
return _comma_count + 1;
}
What you end up with is an array of Strings, in your case with
$GPGGA,095350.000,5112.1239,N,04315.0058,E,1,7,1.13,0.3,M,47.2
msg_field[0] = $GPGGA
msg_field[1] = 095350.000
msg_field[2] = 5112.1239
msg_field[3] = N
msg_field[4] = 04315.0058
msg_field[5] = E
msg_field[6] = 1
msg_field[7] = 7
msg_field[8] = 1.13
msg_field[9] = 0.3
msg_field[10] = M
msg_field[11] = 47.2
and the byte value returned would be 12, the number of fields. So then you would play around with fields 1 thru 5 if I see the bold correctly.
Have fun