lastIndexOf function(Power Automate Cloud flows)

Japanese version.

Get the starting position of the last match of the specified text (right-most matching text).

Spec

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

How to use

The lastIndexOf 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 lastIndexOf 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 you use "lastIndexOf('abcdefabc','abc')" as in the example,
The result is 6, which is the start of the second "abc".

In the case of the similar function indexOf, the leftmost result is 0.

The result is the same for "lastIndexOf('abcdefAbc','aBc')" as it is case-insensitive.

If 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

Example of use.

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

Used for editing dynamic content.