This function searches for a specific substring in the input string, and returns the position (zero based index) of the first occurrence of the specified substring. If the substring is not found, it returns -1. You can add an optional index argument to this function to specify the position where to start in the input string.$string.indexOf(<inStr>, <subStr>[, <index>])
inStrsubStrindex Optional start index (zero based) that sets the start position for the search. If not set the search will start from the first character in the input string (i.e. index=0).#set($str='But to be able to do this you have to do that!')
#set($pos=$string.indexOf($str, 'to'))
Position is: $posPosition is: 4
Example 99 #set($str='But to be able to do this you have to do that!')
#set($pos=$string.indexOf($str, 'to', 5))
Position is: $posPosition is: 15
| OpenText StreamServe 5.6.2 | Updated: 2018-01-26 |