SysUtils.StrEnd、SysUtils.StrLen
StrEnd 获取 PChar 串未指针; StrLen 获取 PChar 串长度.unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} //StrEnd: procedure TForm1.Button1Click(Sender: TObject); var p: PChar; str: string; begin str := '123456789'; p := StrEnd(PChar(str)); ShowMessage(p-3); {789} end; //StrLen: procedure TForm1.Button2Click(Sender: TObject); var p: PChar; i: Integer; begin p := '123456789'; i := StrLen(p); ShowMessage(IntToStr(i)); {9} i := Length(p); ShowMessage(IntToStr(i)); {9} end; end.SysUtils 单元下的公用函数目录
posted on 2008-05-12 23:05 万一 阅读(2135) 评论(0) 编辑 收藏