In this Power Automate tutorial, we will discuss Power automate String Functions with a few examples. And also we will discuss the below Points:
- Introduction to string Function in Power Automate.
- List of String Function In power Automate
- Examples Of string Function in Power Automate
- Power automate limit string length
Introduction to String Function in Power Automate
The string Function in Power Automate is used to convert strings, string characters, format the string, and many more.
Whereas text modification is a basic technique that is used extensively in an attempt to format better or convert data to other sources.
List of String Function In Power Automate
Here we will discuss the list of String Functions used in Power Automate with description and Syntax.
String Function | Description | Syntax |
---|---|---|
concat | In Power Automate this flow combines any number of strings together. This function requires more than one parameter in the form of a string to combine into a single string | concat(text 1, text 2. text 3) |
substring | This function in Power automate returns a subset of characters from a string. This function requires 3 parameters: the string from which the substring is taken; the index where the substring begins; and the length of the substring. The last two-parameter of the function is number. | substring (text, startIndex,length) |
replace | This function is used to replace a string with a given string. So, it requires 3 parameters: the base string that contains the string to be searched for using parameter 2 and then updates the parameter 3; the string to search for; at last the string to replace the string from parameter 2. | replace (text, old text, new text) |
guid | This function is used to generate a global unit string (GUID). An example of this function is if a document requires a unique id. It contains an optional parameter, which is a single format specifier that indicates how to format the GUID | guid () |
toLower | This function is used to convert a string to Lowercase. Functions require only 1 parameter i.e. the string needs to be converted to Lower case | toLower (text) |
toUpper | This function is used to convert a string to uppercase. Functions only require one parameter, which is the string that needs to be converted to uppercase. | toUpper (text) |
indexOf | This function is used to find the index of a value within a given string case insensitivity. And the Function requires only two parameters: the string that contains the value and the value to search the index of. | indexOf(text, searchText) |
lastIndexOf | This function is used to find the last index of a value within a given string case insensitivity. And the functions require 2 parameters i.e. the string that contains the value and the value to search the index of. | lastIndexOf (text, searchhText) |
startsWith | This function is used to check if a string starts with a given value case insensitivity. And this function requires 2 parameters i.e. the string that contains the value and the value the string may start with. The output is boolean i.e. True and False. | startsWith (text, searchText) |
endsWith | This function is used to check if a string ends with a given value case-insensitively. This function requires 2 parameters i.e. the string that contains the value and values the string ends with. The output is Boolean (True and False). | endsWith (text, search Text) |
split | This function is used to split the string using a separator. And this function requires 2 parameters i.e. the string to split and the separator. | split(text, separator) |
length | This function returns the number of character present in a string. | length(text) |
Read Convert SharePoint document to PDF using Power Automate
Examples Of string Function in Power Automate
Here we will discuss the list of Power Automate string functions with examples.
Example 1: Power Automate String concat function
Here we will see how to use string function concat in the Microsoft Flow or Power Automate.
In Power Automate, select manually trigger flow. Then click on the Next step.
Select the initialize variable action, set the variable name as the First name, and type as String. Then set the value as per your requirement.
Then click on Next step, and select initialize variable action. Next set the variable name as LastName, type string, and provide a value.
Now click on the next step and select Compose action. In the input box add the below expression:
concat(variables('FirstName'),variables('LastName'))
Now click on Save and Run the Flow. We can see the result in the output of Compose action that is both the string concatenated.
Read Microsoft Flow Example: Copy files from one SharePoint Online account or folder to another
Example 2: Using Power Automate Substring function
Here we will see how to use the substring function in the Power Automate.
In Power Automate select manually trigger flow. Click on the Next step.
Select the Initialize variable action and then set the variable as name, type as string, and set the value.
Then add the compose action to get the substring ‘Watson’ from string ‘Emma Watson’.
So, click on the next step, select compose action and then in the input box add the below expression to get the substring:
substring(variables('Name'),5,6)
Now click on save and run the flow. We will see the result in the output of compose action.
Read Move files from OneDrive for Business to SharePoint Online
Example 3: Using Power Automate string replace function
Here we will see how to use replace string function in Microsoft Flow or Power Automate.
In Power Automate select the manually triggered flow and click on Next step.
Select the initialize variable action, then set the variable name, Type as a string, and set the value below.
Now we will replace a string ‘ Watson’ with another string ‘Bidden’.
So, click on the next step, and then select the ‘Compose’ action. In the input box write the below expression:
replace(variables('Name'),'Watson','Bidden')
Now click on the save and run the flow, you can see the result in the compose output.
Read Unable to process template language expressions in action Power Automate
Example 4: Using Power automate string toLower function
Here we will see how to use the toLower string function in Power automate.
In Power automate select Manually triggered flow and then click on Next Step.
Select the initialize variable action, and then set the name, type as string, and value.
Now we will convert the whole string to lower case and similarly you can change it to uppercase.
Then click on the Next step and select the Compose action. In the input box add the below expression.
toLower(variables('Name'))
Now click on Save and run the flow. we can see the result in the output of the Compose action in Microsoft Flow.
Read Power Automate update SharePoint list item
Example 5: Using Power Automate string indexOf function
Here we will see how to use the string indexOf function in Microsoft Flow.
In Power automate select the manually triggered flow and click on the next step.
Select the initialize variable action, and then set the variable name, type as string, and value.
Now we will get the index of substring Watson from string ‘Emma Watson’ by using the indexOf function.
indexOf(variables('Name'),'Watson')
Now save and run the flow manually, we can see the result in the compose output.
Read Trigger Conditions in Power Automate
Example 6: Power Automate string lastIndexOf function
Here we will see how to use the string lastIndexOf function in Microsoft Flow.
In Power Automate select the manually triggered flow and click on the next step.
Select the initialize variable action and then set the variable name, type as a string, and the value.
Now click on Next step, and then select compose action. In the Input add the below expression:
lastIndexOf(variables('Name'),'Watson')
Now click on Save and run the flow manually, then see the result in the compose output.
Read Power Automate Forms to Excel
Example 7: Using Power automate startsWith string function
Here we will see how to use startsWith function in the Microsoft flow.
Select the Manually triggered flow in Power Automate. Click on the Next step.
Now select initialize variable action, then set the variable name, type as string, and value.
Here we will search the text from the string, if it is found then startwith() return true or else false.
So, click on the Next step and then select compose action. And in the input box add the below expression:
startsWith(variables('Name'),'Emma')
Now click on Save and run the flow, and check the result in the compose output.
Read Power Automate create an HTML table
Example 8: Using Power automate endWith string function
Here we will see how to use endsWith function in the Microsoft Flow.
In the Power Automate select the manually triggered flow. Click on Next Step.
Select the initialize variable, then set the variable name type as string and value.
Now we will check in the string whether the text ends with that text or not, then the endsWith function will return true else return false.
After that click on the Next step, choose the compose action. In the input write the below expression:
endsWith(variables('Name'),'Watson')
Now click on the save and run the flow manually. we can see the result in the compose action.
Read Power Automate Switch case
Example 9: Using Power Automate string split function
Here we will see how to use split function in the Power Automate or Flow.
In the Microsoft Flow select the manually triggered flow. Then click on the Next step.
Select the initialize variable action and then set the variable name, type as string and values.
Now we will split the string using a separator space ” ” using split function.
So, click on the next step, then select the compose action and in input box add the below expression:
split(variables('Name'),' ')
Now click on the Save and run the flow manually. We can see the result in the compose output.
Read Power Automate send an email with an attachment from SharePoint
Example 10: Using Power Automate string length function
Here we will see how to uselength function in Power automate or Microsoft flow.
Select manually triggered flow in the Power automate and then click on the Next step.
Select the initialize variable action, then set the variable name, type as string, and value.
Now we will find the length of the string by using the length function in Microsoft flow.
So, click on the Next step, the select the compose action. In input write the below expression:
length(variables('Name'))
Now click on Save and run the flow manually, we can see the result in the compose action.
Read Power automate approval reminder
Power Automate limit string length
Here we will see how to limit the string length up to 256 characters in Power Automate.
In Power automate click on the Manually triggered flow. Then click on the Next step.
Select the compose action, here in input box we will add some dummy text like below:
Now we will check the output of the compose action is greater than 256 characters, then grab the 256 characters else output the whole string.
So, for this click on the next step, then select compose action, and in input write the below expression:
if(greater(length(outputs('Compose')), 256),
substring(outputs('Compose'), 0,256),outputs('Compose'))
Now click on save and run the flow. we can see the result in the compose output.
You may like the following Power Automate tutorials:
- Power Automate Get Data from Excel on SharePoint
- Power Automate Date Functions
- Power Automate Parse Email Body
- Power Automate send email from shared mailbox
- Microsoft Flow or PowerAutomate Example: Save my email attachments to a SharePoint document library
- Power automate split string into an array
- Power Automate export SharePoint list to excel and send an email
- Power Automate remove characters from a string
- Power Automate update SharePoint list increment integer field
- Power Automate Set Variable
- Power Automate delete file from SharePoint
- Power Automate IF
In this Power Automate tutorial, we learned different string functions in Power Automate or Microsoft Flow. And also we discuss the below points:
- Introduction to string Function in Power Automate.
- List of String Function In power Automate
- Examples Of string Function in Power Automate
- Power automate limit string length
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.
Thanks, Bijay! I found your tutorial to be quite helpful and will check out your other resources.