Hello,
I've been assigned to complete a project that's using Power Automate. I need to be able to check whether the first letter of a string is in upper or lower case. I'm able to get the first character of the string but unsure how to check the what case it is in Power Automate. I'm still new Power Automate, usually in C# I would've used the isUpper/isLower methods to check letter casing. I'm unable to find an equivalent method in Power Automate; there's a toUpper and toLower but that isn't what I need right now.
Any help is much appreciated.
Try this:
equals(toUpper(first(variables('s1'))),first(variables('s1')))
@ta-cpc
You can also just create a compose with an array and all the values you want to check for, like:
["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
Then you can just use a first( ) and contains( ) expressions to check if that 1st character is in the array of capital letters.
I believe I've managed to make something, unsure if it's the right way but it seems to be doing what I need. I've made a Compose node and added the following expression for the its input:
contains(first(split(variables('Test'),'.')[0]), first(toupper(split(variables('Test'),'.')[0])))
I've already had a variable called "Test" set before hand. Typically would store a string with a period separating the two e.g. "test.data", which is why I'm using the split method (I'm only going to test for case in the first word, since that's more than enough for me needs). The "first" method is to get the first character of the string. I then use the contains method to check against a second argument; same as the first except I've explicitly set the character to its upper case form.
After doing all that, the Compose node that the above code is in should return either a true or false value. I make an If-Control node after the compose to check if the output of the Compose node is true or not. That's how I've managed to check for letter case. Still open to a simpler way of checking for letter case
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional