好说,好说 ;
定义一个文件变量,以可读写的 方式打开这个文件,然后判断
如;
if (TStringsValue[I] = '') and (TStringsValue[I + 1 ] = '') then
begin
TStringsValue[I] := #10;
TStringsValue[I + 1] := #13;
end;
定义一个文件变量,以可读写的 方式打开这个文件,然后判断
如;
if (TStringsValue[I] = '') and (TStringsValue[I + 1 ] = '') then
begin
TStringsValue[I] := #10;
TStringsValue[I + 1] := #13;
end;
var
intPos, i: integer;
s : Tstrings;
begin
result := true;
s := Tstringlist.create;
try
s.loadfromfile(filename);
intPos := Pos(' ', s.Text);
while (intPos <> 0) do
begin
for i := intPos to Length(s.text) do
begin
if (s.text[i] <> ' ') then
break;
end;
Delete(s.text, intPos, i - intPos); //[Error] BOYATTE.pas(89): Constant object cannot be passed as var parameter
Insert(#13#10#13#10, s.text, intPos); //[Error] BOYATTE.pas(89): Constant object cannot be passed as var parameter
intPos := Pos(' ', s.text); //[Error] BOYATTE.pas(89): Constant object cannot be passed as var parameter
end;怎么回事?
while (intPos <> 0) do
begin
i := intPos;
Insert(#13#10, Dst, intPos);
intPos := Pos('', Dst);
end;但这样会引起死循环,有什么解决办法?
begin
i := intPos;
dst:=Copy(dst,1,Pos('', Dst)-1)
+Copy(dst,Pos('', Dst)+3,255);
Insert(#13#10, Dst, intPos);
intPos := Pos('', Dst);
end;
这是第二段这是第二段这是第二段这是第二段这是第二段
这是第三段这是第三段这是第三段这是第三段这是第三段即在文章的两个空格(或一个空格,或两个以上的空格)前添加一个回车换行?
我试写出了下面的代码: intPos := Pos('', Dst);
while (intPos <> 0) do
begin
i := intPos;
Insert(#13#10, Dst, intPos);
intPos := Pos('', Dst);
end;但这样会陷入死循环。即文件定位的指针始终停在第一个“”前面,怎么解决这个问题?