[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'sysutils' (#rtl)

# TStringHelper.LastIndexOf

Find the last position (index) of a string or character

## Declaration

Source position: syshelph.inc line 133

`public function TStringHelper.LastIndexOf(`
`AValue: Char`
`):SizeInt; overload; function TStringHelper.LastIndexOf(`
`const AValue: string`
`):SizeInt; overload; function TStringHelper.LastIndexOf(`
`AValue: Char;`
`AStartIndex: SizeInt`
`):SizeInt; overload; function TStringHelper.LastIndexOf(`
`const AValue: string;`
`AStartIndex: SizeInt`
`):SizeInt; overload; function TStringHelper.LastIndexOf(`
`AValue: Char;`
`AStartIndex: SizeInt;`
`ACount: SizeInt`
`):SizeInt; overload; function TStringHelper.LastIndexOf(`
`const AValue: string;`
`AStartIndex: SizeInt;`
`ACount: SizeInt`
`):SizeInt; overload;`

## Description

LasyIndexOf returns the zero-based index of the last occurrence of AValue in the string (Self). The value to search for can be a character or string (AValue).

if no match is found, -1 is returned.

The search can be refined by specifying a (zero based) index StartIndex. When specified, the search will start at the given character and proceeds towards the beginning of the string. Not specifying this option is equivalent to specifying length-1.

If ACount is given, at most ACount characters in the source string will be considered for the search. This count includes the starting character. Not specifying this argument is equivalent to specifying StartIndex+1.

## See also

Pos |  | Search for substring in a string.
TStringHelper.IndexOfUnQuoted |  | Index of string, skipping quoted parts.
TStringHelper.IndexOfAny |  | Find the position (index) of any string or character in a list.
TStringHelper.IndexOfAnyUnquoted |  | Find the position (index) of any string or character in a list.
TStringHelper.IndexOf |  | Find the position (index) of a string or character
TStringHelper.LastIndexOfAny |  | Find the last position (index) of any string or character in a list.