Skip to content
Reference > Methods

strIndexOf(text,toFind,start,ignoreCase)

Definition

Integer strIndexOf(String text, String toFind, Integer start, Boolean ignoreCase)

Description

Returns the 0 based index of the toFind within the text starting at the specified index, with the option to ignore case. If toFind does not exist from the specified start index, returns -1.

Parameter Definition

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

Examples

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