The
system function StrLib.findStr searches for the
first occurrence of a substring in a string.
StrLib.findStr(
source VagText in,
sourceSubstringIndex INT inOut,
sourceSubstringLength INT in,
searchString VagText in)
returns (result INT)
- result
- Numeric item that receives one of the following values (defined as type
INT or the equivalent: type BIN with length 9 and no decimal places) returned
by the function:
- -1
- Search string was not found
- 0
- Search string was found
- source
- String from which a source substring is derived. Can be an item or a literal.
- sourceSubstringIndex
- Identifies the starting byte for the substring in source,
given that the first byte in source has the index
value of 1. This index can be an item defined as type INT or the following
equivalent: type BIN with length 9 and no decimal places.
- sourceStringLength
- Identifies the number of bytes in the substring that is derived from source.
This index can be an item defined as type INT or the following equivalent:
type BIN with length 9 and no decimal places.
- searchString
- String item or literal to be searched for in the source substring. Trailing
blanks or nulls are truncated from the search string before searching begins.
If searchString is found in the source substring, sourceSubstringIndex is
set to indicate its location (the byte of the source where the matching substring
begins). Otherwise, sourceSubstringIndex is not
changed.