scanUntil

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

The scanUntil method of the String primitive type returns a 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
    stringValue : String;
    pos         : Integer;
begin
    stringValue := "this:is/a;string";
    pos := 1;
    write stringValue.scanUntil(":/;", pos);  // Outputs this
    pos := pos+1;
    write stringValue.scanUntil(":/;", pos);  // Outputs is
end;

See also the String primitive type getNextToken and scanWhile methods.