Substring.NextWord Method

function NextWord: Boolean;

Moves the window to the next space-delimited word.

Returns: Boolean - False after the last word.

Examples

Counting words, an empty one between two spaces included.

uses Substr;

procedure Example;
var s: Substring;
    n: Integer;
begin
    s := Substring('a  b');
    n := 0;
    if s.FirstWord then
        repeat
            Inc(n);
        until not s.NextWord;
    Assert(n = 3);
end;
See Also: Substring.FirstWord