Substring.FirstWord Method

function FirstWord: Boolean;

Moves the window to the first space-delimited word.

Returns: Boolean - True.

Remarks:

Words are separated by single spaces: two spaces enclose an empty word.

Examples

The words of a text.

uses Substr;

procedure Example;
var s: Substring;
    N: Integer;
begin
    s := Substring('to be or');
    N := 0;
    if s.FirstWord then
        repeat
            case N of
                0: Assert(s = 'to');
                1: Assert(s = 'be');
                2: Assert(s = 'or');
            end;
            Inc(N);
        until not s.NextWord;
    Assert(N = 3);
end;
See Also: Substring.NextWord