%dw 2.0
output application/json
---
{
  present: ["a","b","c","d"] lastIndexOf "c",
  notPresent: ["x","w","x"] lastIndexOf "c",
  presentMoreThanOnce: ["a","b","c","c"] lastIndexOf "c",
}
lastIndexOf
lastIndexOf(array: Array, value: Any): Number
Returns the index of the last occurrence of the specified element in a given
array or -1 if the array does not contain the element.
Introduced in DataWeave version 2.4.0.
lastIndexOf(array: String, value: String): Number
Takes a string as input and returns the index of the last occurrence of
a given search string within the input. The function returns -1 if the
search string is not present in the input.
Introduced in DataWeave version 2.4.0.
Parameters
| Name | Description | 
|---|---|
  | 
The string to search.  | 
  | 
A string value to search for within the input string.  | 



