Copy Code code as follows:
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 Generate random number of seeds
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));/return 5
G:= Posex (c, ' | ', i) +1;//return 5
Test.text:=test.text+inttostr (Posex (c, ' | ', y));/return 5
G1:=posex (c, ' | ', y);/return 5
X:=copy (C,G,G1-G);
Memo1.text:=x;
End
End.