indexOf function(Power Automate Cloud flows)

03/11/2024

Japanese version.

Gets the starting position of the specified text (left-most matching text), similar to Excel's FIND function.

The same can be done with the "Find text position" action.

The obtained start position can be used in the following ways.

  • Editing some text
  • Determines whether the specified text exists or not.

There is a similar function called contains for determining the existence of text, but it behaves differently as follows.

FunctionResultCase-sensitive.
containsBoolean.
Exists (true).
Does not exist (false).
Case-sensitive.
indexOfStart position of the found text.Not Case-sensitive.

Spec

indexOf('<text>', '<searchText>')
ArgumentDefaultDescription
textRequired fieldTarget text.
searchTextRequired fieldText to be searched.

How to use

The indexOf 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 indexOf 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.)

If you see something like the following, your settings are complete.

You can change the contents of the function by clicking on the purple icon.

If we use indexOf('abcde','bcd') as in the example,The result is 1 because 'bcd' is the second character.

indexOf('aBcde','bCd') is also case-insensitive, so the result is the same.

If found at the beginning, 0 is the result.

If no match is found, the result is -1.

If there are multiple matches, the result of the first match (left most) is retrieved.

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

Example of use.

When a file is created Trigger in OneDrive For Business Connector.(Power Automate Cloud flows)

Used for editing dynamic content.

How to use only URL parameters.

How to remove URL parameters.