All Power Automate Text Functions (With Examples)
All Power Automate Text Functions (With Examples) Posted by - Matthew Devaney on - December 3, 2023 20 Comments Power Automate text functions are frequently ...
- Published
- Reading time
- 7 min read
Before you start
Is this guide for you?
- Best entry point
- Power Automate
- Time investment
- 7 min read
Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/all-power-automate-text-functions-with-examples/. Author: Matthew Devaney.
All Power Automate Text Functions (With Examples) Posted by - Matthew Devaney on - December 3, 2023 20 Comments
Power Automate text functions are frequently used when writing expressions. It is important to understand all of them and what they do. In this article I will list all of the Power Automate text functions and show examples of how to use them. Table of Contents Chunk Function Concat Function EndsWith Function FormatNumber Function GUID Function IndexOf Function isFloat Function isInt Function LastIndexOf Function Length Function NthIndexOf Function Replace Function Slice Function Split Function StartsWith Function Substring Function ToLower Function ToUpper Function Trim Function Chunk Function Purpose
Split a text string into an array into chunks of a specified length Syntax chunk(collection, length) Arguments
collection – Required. The text string to split into chunks.
length – Required. The length of the chunks as a whole number. Example
Split a text string into 20 character chunks.
chunk( 'The quick brown fox jumps over the lazy dog' , 20 ) Code language: JavaScript ( javascript ) Result [ "The quick brown fox " , "jumps over the lazy " , "dog" ] Code language: JSON / JSON with Comments ( json ) Concat Function Purpose
Join multiple text strings into a single text string Syntax concat(text1, text2, …) Arguments
text – Required. One or more text strings to be joined Example
Join a folder path, filename and extension into a single text string.
concat( 'https://matthewdevaney.com/files/' , 'samplefile' , '.pdf' ) Code language: JavaScript ( javascript ) Result
https: //matthewdevaney.com/files/samplefile.pdf Code language: JavaScript ( javascript ) EndsWith Function Purpose
Determine whether a substring is found at the end of a text string and return a true/false value Syntax endsWith(text1, text2, …) Arguments
text – Required. Text string where the substring may be located
searchText – Required. Substring to look for at the end of the text string Example Check if the file is an Excel file.
endsWith( 'Timesheet_MD_20231124.xlsx' , '.xlsx' ) Code language: JavaScript ( javascript ) Result true Code language: JavaScript ( javascript ) FormatNumber Function Purpose
Change a number into a string with the specified format Syntax formatNumber(number, format, locale) Arguments
number – Required. The number to be formatted.
format – Required. A text-based formatting code locale – Optional. Language code. Example Format a decimal number as currency.
formatNumber( 1315.2 , '$#,##0.00' , 'en-us' ) Code language: JavaScript ( javascript ) Result $1,315.20 GUID Function Purpose Generates a random GUID. Syntax guid(format) Arguments
format- Optional. Default format is “D”. Can also be “B”, “N”, “P”, or “X”. Example Create a GUID value. guid() Result 536cebdf-7ec1-41c3-98bf-6a04efe7bfbe IndexOf Function Purpose
Find the starting position of a substring in a text string Syntax indexOf(text, searchText) Arguments
text – Required. Text string where the substring may be located.
searchText – Required. Substring to look for the first occurrence of. Example
Find where the position where the full name value starts based on the separator ‘: ‘.
indexOf( 'Full Name: Matthew Devaney' , ': ' ) Code language: JavaScript ( javascript ) Result 9 isFloat Function Purpose
Determine whether a text string is of type float Syntax isFloat(string) Arguments
string – Required. Text string to be tested. Example
Check whether the value “0.9723” is a float. isFloat( '0.9723' ) Code language: JavaScript ( javascript ) Result true Code language: JavaScript ( javascript ) isInt Function Purpose
Determine whether a text string is of type integer Syntax isInt(string) Arguments
string – Required. Text string to be tested. Example
Check whether the value “10” is an integer. isInt(10) Result true Code language: JavaScript ( javascript ) LastIndexOf Function Purpose
Find the last position of a substring in a text string Syntax lastIndexOf(text, searchText) Arguments
text – Required. Text string where the substring may be located.
searchText – Required. Substring to look for the last occurrence of. Example
Find the final comma in the comma-separated text string
lastIndexOf( '01,3002,Accounts Receivable,50252.00' , ',' ) Code language: JavaScript ( javascript ) Result 27 Length Function Purpose
Returns the number of characters in a text string Syntax length(collection) Arguments
collection – Required. The text string to measure Example
Determine how many characters are in the following sentence.
length( 'The quick brown fox jumps over the lazy dog' ) Code language: JavaScript ( javascript ) Result 43 NthIndexOf Function Purpose
Find the nth position of a substring in a text string Syntax nthIndexOf(text, searchText, occurence) Arguments
text – Required. Text string where the substring may be located.
searchText – Required. Substring to look for the nth occurrence of.
occurrence – Required. Nth number of the occurrence to look for. Example
Find the 2nd comma in the comma-separated text string
nthIndexOf( '01,3002,Accounts Receivable,50252.00' , ',' , 2 ) Code language: JavaScript ( javascript ) Result 7 Replace Function Purpose
Replace a substring of old text with another substring of new text. Syntax replace(text, oldText, newText) Arguments
text – Required. The text string containing the old text.
oldText – Required. The old text to search for and replace.
newText – Required. The new text to replace the old text with. Example
Remove any commas from the text string by replacing them with a blank space.
replace( 'John, Bradley, Smith' , ',' , ' ' ) Code language: JavaScript ( javascript ) Result John Bradley Smith Slice Function Purpose
Extract a range of characters from the middle of a text string Syntax slice(text, startIndex, endIndex) Arguments
text – Required. The text string containing substring.
startIndex – Required. The starting position of the substring. Index starts at 0.
endIndex – Optional. The ending position of the substring. If blank goes until the end of the string Example
Extract the 5 digit purchase order number from the middle of the string Slice( 'PO-12345-US' , 3 , 8 ) Code language: JavaScript ( javascript ) Result 12345 Split Function Purpose
Split a text string into an array of values by specifying a delimiter Syntax split(text, delimiter) Arguments
text – Required. The text string to be split into an array.
delimiter – Required. The character to separate text strings upon Example
Split the comma separated text string at each comma.
Split( '01,3002,Accounts Receivable,50252.00' , ',' ) Code language: JavaScript ( javascript ) Result
[ ' 01 ', ' 3002 ', 'Accounts Receivable', ' 50252.00 ' ] Code language: JSON / JSON with Comments ( json ) StartsWith Function Purpose
Determine whether a substring is found at the beginning of a text string and return a true/false value Syntax startsWith(text1, text2, …) Arguments
text – Required. Text string where the substring may be located
searchText – Required. Substring to look for at the start of the text string Example
Check if the file name starts with “Timesheet”.
startsWith( 'Timesheet_MD_20231124.xlsx' , 'Timesheet' ) Code language: JavaScript ( javascript ) Result true Code language: JavaScript ( javascript ) Substring Function Purpose
Extracts a substring given number of characters from the middle of a supplied text string Syntax substring(text, startIndex, length) Arguments
text – Required. The text string to extract a substring from.
startIndex – Required. The starting position of the substring. Index starts at 0.
length – Optional. The length of the substring. If blank goes until the end of the string. Example
Extract the 5 digit purchase order number from the middle of the string substring( 'PO-12345-US' , 3 , 5 ) Code language: JavaScript ( javascript ) Result 12345 ToLower Function Purpose Convert a text string to lowercase Syntax toLower(text) Arguments
text – Required. The text string to convert to lowercase. Example
Convert the email address to all lowercase characters toLower( ' [email protected] ' ) Code language: JavaScript ( javascript ) Result matthew .devaney @workplace .com Code language: CSS ( css ) ToUpper Function Purpose Convert a text string to uppercase Syntax toUpper(text) Arguments
text – Required. The text string to convert to uppercase. Example
Convert the month of January to Uppercase toUpper( 'January' ) Code language: JavaScript ( javascript ) Result JANUARY Trim Function Purpose
Removes blank spaces from the start and the end of a text string Syntax trim(text) Arguments
text – Required. The text string with blank spaces at the start or end Example
Remove the blank spaces from the start and end of the email address trim( ' [email protected] ' ) Code language: JavaScript ( javascript ) Result Matthew .Devaney @workplace .com Code language: CSS ( css ) Did You Enjoy This Article? 😺
Subscribe to get new Copilot Studio articles sent to your inbox each week for FREE Enter your email address Sign Me Up Questions?
If you have any questions or feedback about All Power Automate Text Functions (With Examples) please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion. Matthew Devaney Power Automate
Save Docusign Document To SharePoint With Power Automate
Tagged
Power Automate
Have a Microsoft 365 topic idea?
Share article suggestions, community session ideas, corrections, or real-world scenarios for future nextM365 learning notes.
Keep learning Microsoft 365
Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.
Continue learning
Related tutorials
Related questions
Related comparisons
Next action