Onetastic Macro Documentation >
>
>
String_FindLast String_FindLast
Finds the last occurence of a search string in an input string. Returns true if the string was found and the offset it was found at, false otherwise.
Syntax
Bool String_FindLast(
String string,
String search,
Numeric offset,
Bool ignorecase,
out Numeric foundAt)
Parameters
- String string
- String to search in.
- String search
- The substring to search for.
- Numeric offset
- Offset of the input string to start search from. If positive, search will only look at this number of characters at the beginning of the string. If negative, the search will not include this number of characters at the end of the string. If zero, the search will include the whole string.
- Bool ignorecase
- Ignores the case of the strings if set to true.
- out Numeric foundAt
- If the search string is found, the offset of the last occurence is stored in this variable.
Examples
$string = "a4 b6 c5 4a b6 d5 f6 d7 e4 b6 c2 56 d4 5a"
String_FindLast($string, "b6", 0, false, $foundAt)
String_FindLast($string, "b6", 20, false, $foundAt)
String_FindLast($string, "b6", -30, false, $foundAt)
String_FindLast($string, "f9", 0, false, $foundAt)
String_FindLast("The quick brown fox jumps over the lazy dog", "The", 0, false, $foundAt)
String_FindLast("The quick brown fox jumps over the lazy dog", "The", 0, true, $foundAt)
|