A
C
D
I
R
S
T
What is the EndsWith Function?
The EndsWith function is a Power Fx function that is used to determine whether a text string ends with a specific substring. The syntax for the EndsWith function is as follows:
EndsWith(text, suffix)
Where `text` is the text string that you want to check, and `suffix` is the substring that you want to check for at the end of the text string.
The EndsWith function returns a Boolean value (true or false) depending on whether the specified substring is found at the end of the text string.
How to Use the EndsWith Function in Power Apps
Using the EndsWith function in Power Apps is relatively straightforward. Here’s an example of how you can use the EndsWith function to check whether a given email address ends with a specific domain:
1. Create a new canvas app in Power Apps and add a text input control to the screen.
2. Set the Default property of the text input control to a sample email address, such as “john.doe@example.com”.
3. Add a button control to the screen and set the Text property to “Check Email”.
4. Add a Label control to the screen and set the Text property to “Email ends with example.com”.
5. Set the Visible property of the Label control to the following formula:
EndsWith(TextInput1.Text, "@example.com")
6. Save and run the app.
When you enter an email address into the text input control and click the “Check Email” button, the Label control will display “true” or “false” depending on whether the email address ends with “example.com”.
Tips and Tricks for Using the EndsWith Function in Power Apps
Here are some tips and tricks that can help you get the most out of the EndsWith function in Power Apps:
– The EndsWith function is case-sensitive, so make sure that you enter the suffix in the correct case.
– You can use the EndsWith function in combination with other functions, such as the If function, to create more complex formulas.
– The EndsWith function can be used to check for the presence of any substring at the end of a text string, not just email domains.
– If you want to check for the presence of a substring at the beginning of a text string, you can use the StartsWith function instead.
The EndsWith function is a powerful tool that can be used to check for the presence of specific substrings at the end of text strings in Power Apps. By following the steps outlined in this article, you can easily incorporate the EndsWith function into your custom apps and take advantage of its many benefits.