scanUntil

scanUntil(delimiters: StringUtf8;
          index:      Integer io): StringUtf8;

The scanUntil method of the StringUtf8 primitive type returns a UTF8 substring of the receiving string starting from the index specified in the index parameter up to (but not including) the first occurrence of any of the characters specified in the delimiters parameter.

The index of the delimiting character is returned in the second parameter. If a delimiting character is not found, the return value is the remainder of the receiving string (from the specified index) and an index value of zero (0) is returned in the second parameter.

The character search is case-sensitive.

The following example shows the use of the scanUntil method.

vars
    str8 : StringUtf8;
    pos  : Integer;
begin
    str8 := @"this:is/a;string";
    pos := 1;
    write str8.scanUntil(@":/;", pos);  // Outputs this
    pos := pos + 1;
    write str8.scanUntil(@":/;", pos);  // Outputs is
end;