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.
Does not exist (false).
|indexOf||Start position of the found text.||Not Case-sensitive.|
|text||Required field||Target text.|
|searchText||Required field||Text to be searched.|
How to use
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.
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.
Example of use.
When a file is created Trigger in OneDrive For Business Connector.(Power Automate Cloud flows)
Used for editing dynamic content.