Unit unit1;
Interface
Uses
Windows, messages, sysutils, variants, classes, graphics, controls, forms,
Dialogs, stdctrls;
Type userarray = array of string;
Type
Tform1 = Class (tform)
Edit1: tedit;
Button1: tbutton;
Procedure button1click (Sender: tobject );
Private
Function split (S: string; dot: Char): userarray;
{Private Declarations}
Public
{Public declarations}
End;
VaR
Form1: tform1;
Implementation
Uses strutils;
{$ R *. DFM}
Function tform1.split (S: string; dot: Char): userarray;
VaR
STR: userarray;
I, J: integer;
Begin
I: = 1;
J: = 0;
Setlength (STR, 255 );
While pos (dot, s)> 0 do
Begin
STR [J]: = copy (S, I, pos (dot, S)-I );
I: = pos (dot, S) 1;
S [I-1]: = CHR (ord (DOT) 1 );
J: = J 1;
End;
STR [J]: = copy (S, I, strlen (pchar (s)-I 1 );
Result: = STR;
End;
Procedure tform1.button1click (Sender: tobject );
VaR
UR: userarray;
I: integer;
Begin
UR: = Split (edit1.text ,';');
For I: = 0 to 255 do
Begin
If length (UR [I]) = 0 Then exit;
Showmessage (UR [I]);
End;
End;
End.