The toUpper Function sets all items in a string to uppercase. There is the toLower function also, and these functions are super useful, mainly if you collect information from a form from example. People tend to write differently, and having a function that magically transforms everything at once can make a world of difference.
Usage
It follows a simple pattern.
- String
Example:
String
'Manuel T. Gomes'
toUpper(variables('String'))
will return
'MANUEL T. GOMES'
Quite straightforward, right?
Limitations
It will take only uppercase characters that have an uppercase variant. For example, if you pass it “こんにちは” (Hello in Japanese ) it will return the same thing with no error. The same if the string is already in uppercase.
Recommendations:
- When comparing strings, always use toUpper to compare them accurately. If you compare “Manuel T. Gomes ” and “MANUEL T. GOMES,” the result will be false, although you may want the result to be the same. For example:
equals('Manuel','MANUEL')
will return false
equals(toUpper('Manuel'),toUpper('MANUEL'))
will return true
- Use it even if you don’t expect uppercase characters. For example, if you have a site only receiving information from Thai users, the names will, usually, don’t have an upper or lower case, but including the toUpper can avoid issues in the future if something changes.
- In some instances, it’s useful to store one variant of this information. For example, when storing emails, always use an option of the upper or lower case. It will keep the data consistent and more comfortable to compare.
- Don’t nest it. There’s no real reason to do it, but if you find yourself in a situation where you have nested toUpper functions in a formula, you should review it and make everything more straightforward.
Sources:
Microsoft’s toUpper Function Reference
Back to the Power Automate Function Reference.
Photo by Justin Lynch on Unsplash