Skip to content
Reference > Methods

strLastIndexOf(text,toFind,last,ignoreCase)

Definition

Integer strLastIndexOf(String text, String toFind, Integer last, Boolean ignoreCase)

Description

Returns the 0 based index of toFind within the text ending at last, with the option to ignore case. If toFind does not exist in text, return -1.

Parameter Definition

Name Type Description
text String The base string to to find substring from
toFind String the substring to find
last Integer the char to start looking at, null indicates from end
ignoreCase Boolean true indicates it should case insensitive match

Examples

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