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.

For those who want to learn Power Automate Cloud flow effectively

The information on this site is now available in an easy-to-read e-book format.

Or Kindle Unlimited (unlimited reading).

You willl discover how to about basic operations.

By the end of this book, you will be equipped with the knowledge you need to use Power Automate Cloud flow to streamline your workflow.

Links

String Functions(Power Automate Cloud flows)