nthIndexOf function. String.(Power Automate Cloud flows)

Japanese version.

Obtains the starting position of the specified text.

Spec

nthIndexOf('<text>', '<searchText>', <occurrence>)
ArgumentDefaultDescription
textRequired fieldOriginal text.
searchTextRequired fieldText to be searched.
occurrenceRequired fieldSpecifies the number of match results.

How to use

This function is used for text and numeric parameters.

In actions it is often used in "Condition".

It is also used to initialize or set variables of type Integer.

Clicking on nthIndexOf in the "Expression" tab sets the function name and () in the formula field.

Specify text enclosed in "'" and delimited by "," and click OK.

If you want to use dynamic content or variables, the ,delimiter is the same.

(How to get dynamic content with expressions.)

Examples of arguments and results

nthIndexOf('abcabcabc', 'ab', 2) will retrieve the result of the second match from the left.
The result will be 3, which is the start of the second "ab" (0 for the first).

Since it is case-insensitive, nthIndexOf('aBcaBcaBc','Ab',2) will also give the same result.

If two or more matches are not found, the result is -1.

---

Links

String Functions(Power Automate Cloud flows)