最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

截取指定符號(hào)之間的字符串(隨機(jī)讀取)delphi實(shí)例代碼

 更新時(shí)間:2013年12月21日 15:49:51   作者:  
這篇文章主要介紹了截取指定符號(hào)之間的字符串(隨機(jī)讀取)delphi實(shí)例代碼,有需要的朋友可以參考一下

復(fù)制代碼 代碼如下:

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm1 = class(TForm)
    test: TMemo;
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function   PosEx(const   Source,   Sub:   string;   Index:   integer):   integer;
var
   Buf                               :   string;
   i,   Len,   C                   :   integer;
begin
   C   :=   0;
   Result   :=   0;
   Buf   :=   Source;
   i   :=   Pos(Sub,   Source);
   Len   :=   Length(Sub);
   while   i   <>   0   do
   begin
       inc(C);
       Inc(Result,   i);
       Delete(Buf,   1,   i   +   Len   -   1);
       i   :=   Pos(Sub,   Buf);
       if   C   >=   Index   then   Break;
       if   i   >   0   then   Inc(Result,   Len   -   1);
   end;
   if   C   <   Index   then   Result   :=   0;
end;


procedure TForm1.Button1Click(Sender: TObject);
var
i,y:integer;
x,c:string;
g,g1:integer;
begin
 randomize;  //生成隨機(jī)數(shù)種子
            i:=random(30);
            y:=i+1;

 c:='topfox000|topfox001|topfox002|topfox003|topfox004|topfox005|topfox006|topfox0007|topfox008|topfox009|tellyoumysecret000|tellyoumysecret002|tellyoumysecret003|tellyoumysecret004|tellyoumysecret005|tellyoumysecret006|'+
'onhacker046|onionhacker047|onionhacker048|onionhacker049|onionhacker140|onionhacker141|onionhacker142|onionhacker143|onionhacker144';
 test.text:=test.text+inttostr(PosEx( c, '|',i));//返回5
  g:= PosEx( c, '|',i)+1;//返回5
test.text:=test.text+inttostr(PosEx( c, '|',y));//返回5
   g1:=PosEx( c, '|',y);//返回5
x:=Copy(c,g,g1-g);
memo1.text:=x;

end;

end.

相關(guān)文章

最新評(píng)論

延边| 土默特右旗| 阳曲县| 翁牛特旗| 惠水县| 松滋市| 盐亭县| 航空| 吉首市| 汽车| 白玉县| 巍山| 白山市| 崇阳县| 九寨沟县| 江华| 巴马| 大洼县| 石城县| 溧阳市| 沂南县| 邵阳市| 封丘县| 广丰县| 丹江口市| 临高县| 平陆县| 桦甸市| 壶关县| 巴马| 陵水| 留坝县| 丘北县| 铜陵市| 济阳县| 潼南县| 肇庆市| 平遥县| 个旧市| 遂川县| 灵石县|