LISTSERV Maestro 11.1-2 Help Table Of Contents

Calculation Formulas

Back to Calculation Formulas Overview
Back to Functions Overview


Function "LastIndexOf"

LastIndexOf(text, searchfortext [, startindex])

Function: Searches for an occurrence of the text "searchfortext" in the given "text", starting at the end of "text". Returns the zero-based index of the last occurrence of "searchtext", or "-1" if none was found. Optionally, a zero-based "startindex" can be specified with the effect that the search in "text" will not start at the end of "text" but at the character position specified by "startindex" (and then proceed towards the start of "text").

Return-Type: Number

Arguments:
text - Type Text: The text string to search in.
searchfortext - Type Text: The string to search for.

The third argument is optional:
startindex - Type Number: The character position at which the search will be started. If not given, the search will always start at the last character (index "length - 1").

Examples:
LastIndexOf("a longer text", "lo")
LastIndexOf("abc def abc def", "abc", 4)

© 2002-2023 L-Soft Sweden AB. All rights reserved.