var
F: TextFile;
S: string;
MyArray: array[1..6] of string;
i,j:integer;
begin
if OpenDialog1.Execute then { Display Open dialog box }
begin
AssignFile(F, OpenDialog1.FileName); { File selected in dialog }
Reset(F); Readln(F, S); { Read first line of file }
j:=1;
for i:=1 to Length(s) do
begin
if s[i]<>'' then
MyArray[j]:=MyArray[j]+s[i]
else
Inc(j);
end;
CloseFile(F);
end;
end;
F: TextFile;
S: string;
MyArray: array[1..6] of string;
i,j:integer;
begin
if OpenDialog1.Execute then { Display Open dialog box }
begin
AssignFile(F, OpenDialog1.FileName); { File selected in dialog }
Reset(F); Readln(F, S); { Read first line of file }
j:=1;
for i:=1 to Length(s) do
begin
if s[i]<>'' then
MyArray[j]:=MyArray[j]+s[i]
else
Inc(j);
end;
CloseFile(F);
end;
end;
解决方案 »
- [重金]谁用过广东联通公司的模拟短信网关的软件(sgipGW)?
- 用Delphi如何进行并口通信?
- ADO的问题???急急
- 我想学intraweb请问那里可找到资料
- indy 中怎么接收附件,特别是附件有多个的时候(这个很急的!)
- //对PASCAL语句后面栝号的参数不太明白,不明白作用,不明白该加那些参数不是不明白这两句,是不明白语法写在尾巴的参数的作用的通常写法案
- 我刚安装完DELPHI6.0,但怎么控件栏一个控件也没有?
- fastreport 列印
- 调查一下,大家编写有关数据库方面的程序时,是用bde控件,还是用ado控件。
- 数据合并与下发的Appserver,紧急!!!!
- 高手进!
- 有点弱
Cstr, Lstr: string;
F1: TextFile;
begin
AssignFile(F1, 'c:\c.txt');
Reset(F1); while not eof(f1) do
begin
readln(f1,Lstr); while Pos(' ', Lstr) > 0 do
begin
Cstr := copy(Lstr, 0, pos(' ', Lstr) - 1);
Lstr := copy(Lstr, pos(' ', Lstr) + 1, length(Lstr));
showmessage(Cstr);
end; if Trim(Lstr) <> '' then
begin
Cstr := Lstr; showmessage(Cstr);
end;
end;
closefile(f1);
end;
Procedure SubfromStr(Const Str_T:String;Var
Str0,Str1:String);OverLoad;
//Str_T:带分解的字符串
//Str0:Str_T中空格分格的第一个子串
//Str1:剩下的子串 Procedure SubfromStr(Const Str_T:String;Delimiter:Char;Var
Str0,Str1:String);OverLoad; //Str_T:带分解的字符串
//Delimiter:分隔符
//Str0:Str_T中空格分格的第一个子串
//Str1:剩下的子串 Implementation//截取子串
Procedure SubfromStr(Const Str_T:String;Var Str0,Str1:String);
Var
Str:String;
Str_Pos1,Str_Pos2:Integer;
Str_Start,Str_num,Str_pos:Integer;
begin
str:=trim(Str_t);
Str_pos1:=Pos(' ',Str);
Str_pos2:=Pos(',',Str);
Str_pos:=min(Str_pos1,Str_pos2);
if(Str_Pos=0)then
Str_pos:=Max(Str_pos1,Str_pos2); if(Str_Pos=0)then
begin
Str0:=Str;
Str1:='';
end
Else
begin
Str_Start:=1;
Str_Num:=Str_Pos-1;
Str0:=copy(str,Str_Start,Str_Num);
Str_Start:=Str_Num+2;
Str1:=Copy(Str,Str_Start,length(Str));
end;
end;//截取子串,重载
Procedure SubfromStr(Const Str_T:String;Delimiter:Char;Var Str0,Str1:String);
Var
Str:String;
Str_Pos1,Str_Pos2:Integer;
Str_Start,Str_num,Str_pos:Integer;
begin
str:=trim(Str_t);
Str_pos:=Pos(Delimiter,Str); if(Str_Pos=0)then
begin
Str0:=Str;
Str1:='';
end
Else
begin
Str_Start:=1;
Str_Num:=Str_Pos-1;
Str0:=copy(str,Str_Start,Str_Num);
Str_Start:=Str_Num+2;
Str1:=Copy(Str,Str_Start,length(Str));
end;
end;End.