Expression Language
Also available as:
PDF

lastIndexOf

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 last 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.14. Table 14. lastIndexOf Examples

Expression

Value

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

-1

${filename:lastIndexOf('.')}

20

${filename:lastIndexOf('a')}

17

${filename:lastIndexOf('')}

11