function FirstDelimitedText(const Delimiter: string): Boolean; overload;
The tokenizer: puts the window on the text's first field.
| # | Name | Description |
|---|---|---|
| 1 | Delimiter | The text between fields, every text kind. |
Returns: Boolean - True: a text always has a first field, empty when the text is.
Remarks:
The window moves over the underlying text field by field, copying no character: n delimiters give n + 1 fields, empty ones included. NextDelimitedText moves to the next field.
Examples
Every field of a line, the empty one included.
uses Substr;
procedure Example;
var s: Substring;
N: Integer;
begin
s := Substring('a,b,,c');
N := 0;
if s.FirstDelimitedText(',') then
repeat
case N of
0: Assert(s = 'a');
1: Assert(s = 'b');
2: Assert(s.IsEmpty);
3: Assert(s = 'c');
end;
Inc(N);
until not s.NextDelimitedText(',');
Assert(N = 4);
end;
See Also: Substring.NextDelimitedText