The Power Automate StartsWith function checks whether a given string starts with a certain string or not.
Its counterpart is the endsWith function, that does the same for the ending of a string.
In this article, I’ll introduce you to the startsWith function and will provide a step-by-step guide on how to use the function in a Microsoft flow.
Power Automate StartsWith Function
Power Automate StartsWith Function
Determine if a given string begins with a specified substring, ignoring case. Return true if the substring is present, or false if it is not.
Syntax
startsWith('<text>', '<searchText>')
Input parameters
- text (mandatory): The string to be evaluated.
- searchText (mandatory): The starting string to locate.
Return value
- Returns true, if text starts with searchText.
- Returns false, if text not starts with searchText.
Power Automate StartsWith Expression Example
startsWith('John Doe', 'John')
=> true
startsWith('John Doe', 'Doe')
=> false
How To Use The Power Automate StartsWith Function
Follow the steps to use the Power Automate startsWith function in a flow.
-
Create a new flow with trigger ‘Manually trigger a flow’
New flow
-
Add a new step by clicking on ‘+ New step’
Add a new step
-
Search for ‘initialize’ and click on ‘Initialize variable’
Add Initialize variable action
-
Setup Initialize variable: 1) Provide a name, 2) select type String, 3) Set value to ‘John Doe’
Setup variable
-
Add a compose by searching for ‘compose’ and clicking on ‘Compose’
Add Compose action
-
Setup compose action: 1) click into Inputs (popup appears), 2) click on ‘Expressions’, 3) set expression to ‘startsWith(variables(‘name’),’John’)’, 4) click on ‘OK’
Setup startsWith expression in Power Automate
-
Save and do a test run
Result test run – Power Automate StartsWith function example