PowerApps Strings explained by Example [Copy&Paste]

Power Apps Strings

Coming from an object-oriented programming background, working with PowerApps Strings feels strange. As a reference for myself, I’ve collected solutions for common uses cases in this article. There are so many common tasks like concatenation, replace, extract and comparing strings. The examples should speak for themselves and point you to the solution. Here you won’t find long explanations, just short examples. I hope you find some valuable information here.

I’m still learning myself. In case you are finding errors or better solutions. Please, let me know!

How to manipulate PowerApps Strings

Learn string manipulation in PowerApps.

String to number

It is quite common that you have a string that contains a number. To do some mathematical operations on the string’s number, you need to convert the string to number. The Value-Function does convert text to number in Power Apps.

Value("007") + 1 // Returns 8, because 7 + 1 = 8

More information on the conversion of text to numbers can be found here: PowerApps: Convert Text To Number | Value Function Explained

Concatenate Strings / Append String / Add two Strings

Imagine you have one string variable with the first name and another one with the last name of a person. To display the whole name you need to append the last name to the first name. This can be done with the Concatenate-function or you can just use “&”. Take a look at the example!

Concatenate("a","b") & "c" // Returns 'abc'

Concatenate String and Number

To concatenate a string and number simple use the “&” as demontrated below.

"number " & 1 // Returns 'number 1'

Replace String

Replace some character or text within a text is quite common. To replace a string within a string in PowerApps use the Substitute-function.

Substitute("It's me, only me.","me","you") // Returns "It's you, only you."

String to Date

Converting a string to date in PowerApps can easily done by the DateValue-function as long the date string follows one of the common formats.

DateValue("2021-01-05")

String must have one of these formats:

  • MM/DD/YYYY or MM-DD-YYYY
  • DD/MM/YYYY or DD-MM-YYYY
  • YYYY/MM/DD or YYYY-MM-DD
  • MM/DD/YY or MM-DD-YY
  • DD/MM/YY or DD-MM-YY
  • DD Mon YYYY
  • Month DD, YYYY

String to Boolean

In case you want to convert a string to boolean, a string comparison can be used.

If(Lower("FALSE")="false", false, true) // Returns false

Remove last character

To remove a certain number of characters from the end of string, you can use the Left-function. The Left-function takes a string and number. the number is used to indicate how many characters from the left of the string should be in the resulting string. To remove the last character of a string you can use the Len-function to get the length of the strings and subtract 1.

Left("Berlin,Paris,Rom",Len("Berlin,Paris,Rom,") -1) // Returns "Berlin,Paris,Rom"

Split String by Comma / Split string on character / String to Table

In case you need to separate a string by a certain character, use the PowerApps Split function as shown below.

Split( "Berlin,Paris,Rom",",") // Returns "Berlin","Paris","Rom"

Split String by Space

Split a PowerApps string by a whitespace can also be done with the PowerApps Split function:

Split( "Berlin Paris Rom"", " " ) // Returns "Berlin","Paris","Rom"

Split string get first

To get the first item of a splitted string by the PowerApps split function use the PowerApps First function.

First(Split( "Berlin Paris Rom"", " " )) // Returns "Berlin"

How To Compare PowerApp Strings

Contains String / Does not contain

Find("me","Yes, it's me, only me.");  // Returns 11, because first me is at index 11
!IsBlank(Find("me","Yes, it's me, only me.")); // true = contains 'me'
IsBlank(Find("me","Yes, it's me, only me."));  // false = does not contain 'me'

Compare Strings and ignore case / equals case-insensitive

Lower("ABC") = Lower("abc") // Returns true

String starts with

You want to find out if a PowerApps string begins with a certain string? That’s what the StartsWith-Function is for. Note: It is case insensitive

StartsWith("ABC","A"); // Returns true
StartsWith("ABC","a"); // Returns true
StartsWith("abc","A"); // Returns true
StartsWith("abc","b"); // Returns false

String length / Get string length

To check how many characters are within a string use the Len-function which returns the PowerApps string length.

Len("123") // Returns 3

How To Escape PowerApps Strings

Double quotes and new lines within the content of a string need to be escaped. Read here how strings can be escaped in PowerApps.

String line break / String new line

Adding a new line break in PowerApps can be done with the Char-function. Use the code 10 for the line break.

"Bond, " & Char(10) & "James" 

// Returns;
// Bond,
// James

String with double quotes

Double quotes in PowerApps are used to mark the beginning and the end of a string. But how do you get a double quote in your text? You need to escape the quotes with “Char(34)”. In case you have a long text with multiple quotes, it is getting complicated. Therefore I did a little converter that does the escaping for you. Check out my PowerApps double quotes converter.

"She said: " & Char(34) & "Yes." & Char(34) // Returns She said: "Yes."

Leave a Comment

Your email address will not be published. Required fields are marked *