unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
str1,word:string;
i,j:integer;
begin
str1:='dsf4654f6<ds>ad<<<' ;
word:=Edit1.Text;
j:=pos(word,str1);//在字符串str1中查找"<"
if j<>0 then //得到的j是字符串中出现的位置,是整型
showmessage('<'+'在第'+inttostr(j)+'个位置'); //第十个位置
end;
end.
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.060057878494263 seconds