All Power Automate Text Functions (With Examples)

All Power Automate Text Functions (With Examples)

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 FunctionConcat FunctionEndsWith FunctionFormatNumber FunctionGUID FunctionIndexOf FunctionisFloat FunctionisInt FunctionLastIndexOf FunctionLength FunctionNthIndexOf FunctionReplace FunctionSlice FunctionSplit FunctionStartsWith FunctionSubstring FunctionToLower FunctionToUpper FunctionTrim 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)

Result

[
  "The quick brown fox ",
  "jumps over the lazy ",
  "dog"
]




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')

Result

https://matthewdevaney.com/files/samplefile.pdf




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')

Result

true




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')

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', ': ')

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')

Result

true




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




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',',') 

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')

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) 

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', ',', ' ')

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)

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', ',')

Result

[
  '01',
  '3002',
  'Accounts Receivable',
  '50252.00'
]




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')

Result

true




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)

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]')

Result

[email protected]




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')

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] ')

Result

[email protected]





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

Subscribe
Notify of
guest

20 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Jon Russell
1 year ago

Hey Matthew. Slight typo on your startswith function

Ronda
Ronda
1 year ago

Great article there are a few things I thought would be beneficial to add and noticed a few typos:

  1. Chunk (length – Required. The length of the chunks)
  2. Guid, mentioned default of D, what would B, N, P, or X provide?
  3. isInt – example isFloat duplicate from previous example.
  4. nthIndexOf – appears to be duplicate of lastIndexOf, I would expect the result to be the nth result of 2 and be 7 as the location of the comma between 2003,Accounts.
  5. Slice(‘O-12345-US’, 3, 8) returns 1234 as the the endindex character will not be included in the search.
  6. StartsWith as previously mentioned below, example as endsWith and includes .xlsx and not Timesheet.
  7. Trim – example has toLower

I enjoy reading your articles and look forward to trying out some of these text functions I haven’t used before.

Ronda
Ronda
1 year ago

If you retested with this expression Slice(‘O-12345-US’, 3, 8) it would return 12345 as it is missing the P from the original expression. Slice(‘PO-12345-US’, 3, 8), however I am not a power automate user yet and could be wrong, but just wanted to confirm, since your expression wasn’t exact as the example and I read that it didn’t include the last digit value.

Also update language on nthIndex Example
Find the final comma in the comma-separated text string

Last edited 1 year ago by Ronda
Ronda
Ronda
1 year ago

Thanks for the clarification.

Frank Nielsen
Frank Nielsen
1 year ago

Great article Matthew

Steve Morley
Steve Morley
1 year ago

This is great Matthew. I assume your favourite text function is the conCAT function.

Matt Wright
Matt Wright
1 year ago

Several appear to be copy/paste issues. Like endsWith(text1, text2, …).

Eileen O'Reilly-Hoisington
Eileen O'Reilly-Hoisington
1 year ago

Thank you so much for this. It is a gift!

Ibraheem Albasheir
Ibraheem Albasheir
1 year ago

correct me if I am wrong, NthIndexOf Function
you are looking for the 2nd comma not the final comma?

Damian
Damian
1 year ago

Amazing summary! It would be great if you could also describe some specific business or technical scenarios where these functions could be particularly useful. 

Jason
Jason
6 months ago

Any idea why this site lists Left, Right, and other String functions that do not appear to actually be in Power Automate, despite the page being a Microsoft page of Power Automate String functions.

Makes for confusion. Are these planned functions that just have not been released yet? Or a copy/paste error on the part of Microsoft, and they inadvertently posted the Power Apps String functions?

https://learn.microsoft.com/en-us/power-automate/minit/string-operations

Thoughts?

Iwan
Iwan
4 months ago

Hi Matthew, how to convert value to string? Examplae date to string, or int to string.

Thanks

Ken
Ken
2 months ago

Great article. Would love to see an example of how to find a word after a string match. i.e. find “First Name” and match the word after it.