NXSL:rindex

Revision as of 16:13, 13 September 2022 by AlexKirhenshtein (talk | contribs) (Text replacement - "^" to "{{deprecated}}")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This Wiki is deprecated and we are are currrently migrating remaining pages into product documentation (Admin Guide, NXSL Guide)

Returns the position of the last occurrence of substring in string up to or before position if specifed.


Syntax

rindex(string, substring [,position]);


Parameters

string The string which will be examined.
substring The string which we will search for.
position [Optional] The position in string to start searching back from.

All index values are 1-based (i.e. the first character has index 1, not 0).


Return Value

Integer value of the position substring was found at, will return 0 if not found.


Examples

rindex("abcdabcd","cd")  	      ->	7
rindex("abcdef","cd",2)  	      ->	0
rindex("abcdefabcdef","cd",4)	      ->	3