CodePudding user response:
Use TStringLis - & gt; LoadFromFile load file, and then set Delimiter column separator for your file, according to the code below and put StringGrid cell in each category information,The Delimiter is DelimitedText separator, please look at the code below:
[Delphi] view plaincopy
Ts:=TStringList. Create;
Ts. The Delimiter:='#';
Ts. DelimitedText:='aaa# bbb# CCC';
For I:=0 to ts. Do the count - 1
The begin
Showmessage (ts) Strings [I]);
end;
Run the code above, will in turn display:
Aaa
BBB
CCC
Three message box,
If the above statement is changed to:
[Delphi] view plaincopy
Ts:=TStringList. Create;
Ts.Com maText:='aaa, BBB, CCC';//note that this change the '#' to ', ',
For I:=0 to ts. Do the count - 1
The begin
Showmessage (ts) Strings [I]);
end;
Is also displayed:
Aaa
BBB
CCC
Three message box,
Because the default delimiter is of TStringList ', ', and the separator is', 'when the string is assigned to CommaText, then the TStringList strings to', 'as the delimiter separated,
Such as the following:
[Delphi] view plaincopy
Ts:=TStringList. Create;
Ts. Text:='aaa' + # 13 # 10 + 'BBB' + # 13 # 10 + 'CCC';//notice, this time to join in the middle of # 13 and # 10 newline control character,
For I:=0 to ts. Do the count - 1
The begin
Showmessage (ts) Strings [I]);
end;
Or three message box
Aaa
BBB
ccc
CodePudding user response:
I understand, we didn't newFLAG PKGID X Y R M/N PART
CMP 8.8031496 3.5511811 180.0 N C9562 31 948 t1005401; 0=1, 1=0.013780
CMP 8.9291339 3.5511811 180.0 N C9620 31 948 t1005401; 0=1, 1=0.013780
CMP 8.9685039 3.5511811 180.0 N C9621 31 948 t1005401; 0=1, 1=0.013780
CMP 5.496063 4.7125984 0.0 N C9619 31 948 t1005401; 0=1, 1=0.013780
CMP 4.984252 3.5826772 0.0 N C9618 31 948 t1005401; 0=1, 1=0.013780
CMP 4.4606299 3.6574803 180.0 N C9617 31 948 t1005401; 0=1, 1=0.013780
Such as the above is my request to extract the text file x y r part to stringgrid inside it will be better able to use the vector
CodePudding user response:
You this separator is different.. Only by using tstringlist load after detailed segmentation.. Use a container is unlikely.CodePudding user response:
Why is that?That how to make a list of x y r and inside out to overwhelm the vector, and then extracted from the vector into stringgrid inside