Edit

PositionInText (string, pattern [, startChar] [, boolInBytes])

Result Type: Number

Definition: Returns the (1-based) character position of the first occurrence of pattern in string. If startChar is specified, the characters in string up to startChar are not tested for pattern. If the text is not found, returns 0.

If boolInBytes is true or IN_BYTES (which is a constant with value true), then the startChar and the return value are in bytes, not characters. This option should only be used when the string is known to be pure ASCII. It is much faster because it does not account for multibyte unicode characters.

Examples:  PositionInText("Birthday", "day")

returns 6.

PositionInText(song, colour, PositionInText(song, colour) + 1)

Given that song contains “Red, red wine”, and colour contains “red”, this will return 6, which is the position of the second occurrence of “red” in “Red, red wine”.

Note: When searching for a text constant, the equality operator can be used with the pattern enclosed in “@” symbols, e.g. "@day@". For example, if myString = "MoneyWorks rocks!", then the comparison:

myString = "@works@"

would return 1 (true).