Creator Help


This topic describes the syntax and usage of the indexOf function in Zoho Creator .


The indexOf function returns the position of the first occurrence of a specified value in a string.  The positions within the main string starts with zero , the second position is 1, the third is 2 etc. The indexOf function is case sensitive.




find(<string>, <substring>)

// this format is supported only in the free flow scripting mode of Script builder.

The indexOf/find function syntax has the following arguments.

string - Required. The main string to search for

substring - Required.. At which postition to start the search

Return Value

Returns a number which refers to the position where the specified search value occurs for the first time or -1 if it never occurs. 


text="Hello world, welcome to the universe"

text.indexOf("e");   //returns 1

text.indexOf("H");   //returns 0

text.indexOf("z");   //returns -1

find("Hello world, welcome to the universe","e");   //returns 1

find("Hello world, welcome to the universe","H");   //returns 0

find("Hello world, welcome to the universe","z");   //returns -1