UCSearchSubstring (open)
Find the first occurrence of a UTF-8 substring
Syntax
// Core function, no LOADLIB necessary
INTEGER FUNCTION UCSearchSubstring(STRING text, STRING search, INTEGER start)Parameters
STRING textString to search in
STRING searchString to search for
INTEGER startThe character position to start searching
Return value
INTEGERStarting character position of the first occurence, or -1 if the string was not found
Description
UCSearchSubstring does a case-sensitive search in a string for the first occurence of a substring.
Examples
// returns 2
INTEGER example1 := UCSearchSubstring("abcdef", "c");
// returns 0
INTEGER example2 := UCSearchSubstring("ababab", "ab");
// returns -1
INTEGER example3 := UCSearchSubstring("abcdef", "g");
// returns -1
INTEGER example4 := UCSearchSubstring("abcdef", "A");
// returns 2
INTEGER example5 := UCSearchSubstring("ababab", "ab", 1);
// returns -1
INTEGER example6 := UCSearchSubstring("ababab", "ab", 5);