This is an example of what I have done in the past. All this program does is look at a raw RS232 input coming from a GPS device and assigns the values into tags. By the sounds of the post that is what you need to do. The program is quite long so I have only put in part of it.
cstring String;
cstring GPSHeader,NSInd,EWInd;
int Lat,LatMin,LatSec,Long,LongMin,LongSec,nos;
//initialize mydata with data string
String = PortInput(1, 0, '\r', 2000, 0); //rs232
//PortInput(PORT, START, END, TIMEOUT, LENGTH)
if(String != "")
{
//Sentence Identifier (Value &GPGGA)
GPSHeader := (Mid(GPS.rawString,1,Find(GPS.rawString,',',0)-1)); //find the value before first(1st) occurrence of ,
GPS.header := GPSHeader; // stores string header in tag GPS.header as string value
//Latitude (Value ddmm.mmmm)
Lat := TextToInt (Mid(GPS.rawString, Find(GPS.rawString, ',', +1) +1,2),10); //find the value after second(2nd) occurrence of , in the 232 string.
GPS.Lat := Lat;// Latitude postion in decimal stored in GPS.Lat as int data
LatMin := TextToInt (Mid(GPS.rawString, Find(GPS.rawString, '.', +0) -2,2),10); //find the value after second(2nd) occurrence of . in the 232 string.
GPS.LatMin := LatMin;// Latitude postion in decimal stored in GPS.LatMin as int data