把不是空格的字符串进行替换

代码
 1 unit Unit1;
 2 
 3 interface
 4 
 5 uses
 6   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 7   StdCtrls;
 8 
 9 type
10   TForm1 = class(TForm)
11     Button1: TButton;
12     procedure Button1Click(Sender: TObject);
13   private
14     { Private declarations }
15   public
16     { Public declarations }
17   end;
18 
19 var
20   Form1: TForm1;
21 
22 implementation
23 
24 {$R *.DFM}
25 
26 procedure TForm1.Button1Click(Sender: TObject);
27 var
28 s:string;
29 i:integer;
30 begin
31 i:=1;
32 s:='123abc';
33 while(i<=length(s))and(s[i]<>'')do
34 begin
35 s[i]:='f';
36 inc(i);
37 showmessage(inttostr(i));
38 showmessage(s);
39 end;
40 end;
41 end.

 

posted @ 2009-12-11 05:05  懒人博客  阅读(145)  评论(0)    收藏  举报