Skip to content
Reference > Methods

strLastIndexOf(text,toFind)

Definition

Integer strLastIndexOf(String text, String toFind)

Description

Returns the last 0 based index of toFind within the text. If toFind does not exist in text, returns -1.

Parameter Definition

Name Type Description
text String The base string to get a substring from
toFind String the substring to find

Examples

1
2
3
4
5
6
7
8
Integer r1 = strLastIndexOf("what,now","hat"); // r1 == 1
Integer r2 = strLastIndexOf("what,now","what"); // r2 == 0
Integer r3 = strLastIndexOf("What now"," "); // r3 == 4
Integer r4 = strLastIndexOf("what,now"," "); // r4 == -1
Integer r5 = strLastIndexOf("what,now",""); // r5 == 8
Integer r6 = strLastIndexOf("what,now",null); // r6 == -1
Object r7 = strLastIndexOf(null,"test"); // r7 == null
Integer r8 = strLastIndexOf("An example,of, multiple, delims",", "); // r8 == 23