Latest Posts

PowerApps remove leading and trailing spaces from the text


The TrimEnds function in PowerApps is used to remove leading and trailing spaces from a text string. This function is particularly useful for cleaning up user input or data retrieved from external sources, ensuring that spaces do not affect data processing or comparisons.

PowerApps – TrimEnds() function Syntax

 

TrimEnds(Text)

  • Text: The text string from which you want to remove leading and trailing spaces.

PowerApps - remove leading and trailing spaces

To remove leading and trailing spaces from the text " Hello     World ":

TrimEnds("  Hello     World  ")

 

This returns "Hello     World" without the leading and trailing spaces.

PowerApps – remove start and end space from text input

If you have a text input control named TextInput1 and you want to trim the input text:

TrimEnds(TextInput1.Text)

 

PowerApps - Validate User Input after removing spaces

When validating user input, you can use the TrimEnds function to ensure that spaces do not affect the validation logic:

If(IsBlank(TrimEnds(TextInput1.Text)), Notify("Input cannot be empty", NotificationType.Error))

 

PowerApps - Compare Text Values after trimming space

When comparing text values, trimming spaces can prevent mismatches due to extra spaces:

 

If(TrimEnds(TextInput1.Text) = "Admin", Notify("Welcome, Admin!", NotificationType.Success))

 


We value your Feedback:

Page URL:

Name:

Email:


Suggestion:

© 2024 Code SharePoint