Expression Language
Also available as:
PDF

indexOf

Description: Returns the index of the first character in the Subject that matches the String value provided as an argument. If the argument is found multiple times within the Subject, the value returned is the starting index of the first occurrence. If the argument cannot be found in the Subject, returns -1. The index is zero-based. This means that if the search string is found at the beginning of the Subject, the value returned will be 0, not 1.

Subject Type: String

Arguments:

  • value : The value to search for in the Subject

Return Type: Number

Examples: If the "filename" attribute has the value "a brand new filename.txt", then the following Expressions will provide the following results:

Table 1.13. Table 13. indexOf Examples

Expression

Value

${filename:indexOf('a.*txt')}

-1

${filename:indexOf('.')}

20

${filename:indexOf('a')}

0

${filename:indexOf('')}

1