function TForm1.Decompose(ARCD : TData ) : TData;
var RCD : TData;
Count : Integer;
AWord : String;
AFloat : Extended;
Delims : TSysCharSet;
RCDString : String[95];
LatLon : Extended;
begin
RCD := aRCD;
Delims := ['[',']'];
{Extract all words}
RCDString := RCD.RCDLine;
Count := 0;
repeat
Inc(Count);
RCDString := '[00VA][5890633][Alton][United States][K6][36.576][-78.999166667]';
AWord := ExtractWord(Count, RCDString, Delims);
if TryStrToFloat(AWord, AFloat) then begin LatLon := AFloat; end;
Case Count of
0 : ShowMessage('Bad Data in RCD in Decompose Function');
1 : RCD.ICAO := AWord;
2 : begin
RCD.Hash := LatLon;
RCD.HashStr := FloatToStr(LatLon);
end;
3 : RCD.City := AWord;
4 : RCD.Country := AWord;
5 : RCD.Region := AWord;
6 : Begin
RCD.Lat := LatLon;
RCD.LatStr := FloatToStr(LatLon);
end;
7 : Begin
RCD.Lon := LatLon;
RCD.LonStr := FloatToStr(LatLon);
end;
end;
until AWord.IsEmpty;
Result := RCD;
end;
I still have data problems. I have redone the data 3 times today and can't get past this problem.
The issue
unit1.pas(724,6) Fatal: illegal character "'ï'" ($EF)
on line 17.
So under the debugger I copied the data raw and pasted it into RCDString just before I try to parse it. Still get the issue. I think the $EF is the UTF8 BOM.
I'm more than wiling to post this on my GDrive if someone is willing to look at it.
It's easy to duplicate. Start the program and click once on the first record in a listbox2.
Dosn't happen on any other listbox.
I have five listboxes on the screen and it only happens on the one.
I change the first record and second record gets the issue.
But If I click one the second record first it's fine. Go back to the first record and I get the issue.
Is there a way aroud this?