Intro:
Lets unravel the secrets of Power Automate and its mystical abilities in handling strings. Just like ancient scrolls filled with arcane symbols, strings hold immense power – they carry information, convey messages, and shape our digital world. we’ll explore various string manipulation techniques, from simple incantations like text searching to more complex spells like splitting strings into fragments. Whether you’re a seasoned mage or a novice spellcaster, there’s something here for everyone.
Data Setup:
Leveraged compose varaible to store the string / paragraph
Lets unravel the secrets of Power Automate and its mystical abilities in handling strings. Just like ancient scrolls filled with arcane symbols, strings hold immense power – they carry information, convey messages, and shape our digital world. we’ll explore various string manipulation techniques, from simple incantations like text searching to more complex spells like splitting strings into fragments. Whether you’re a seasoned mage or a novice spellcaster, there’s something here for everyone.
Tip 1: Upper Case
Convert a text string to uppercase
toUpper(outputs('String_Input'))
Tip 2: Lower Case
Convert a text string to lowercase
toLower(outputs('ToUpper'))
Tip 3: Concat
Join multiple text strings into a single text string.
This example I have appended INTRO and CLRF to the text
concat('INTRO:',decodeUriComponent('%0A'),outputs('String_Input'))
Tip 4: IndexOf Function
Find the starting position of a substring in a text string
Searching for the text ancient
indexOf(outputs('String_Input'),'ancient')
Tip 5: Search Text
Another cool way to search for starting position of the string is using search text function
{
"kind": "indexOf",
"inputs": {
"text": "@outputs('String_Input')",
"searchText": "ancient"
}
}
Tip 6: LastIndexOf Function
Find the last position of a substring in a text string
lastIndexOf(outputs('String_Input'),'strings')
Tip 7: Length Function
Returns the number of characters in a text string
length(outputs('String_Input'))
Tip 8: NthIndexOf Function
Find the nth position of a substring in a text string
nthIndexOf(outputs('String_Input'),'like',2)
Tip 9: Replace Function
Replace a substring of old text with another substring of new text.
replace(outputs('String_Input'),'ancient','antique')
Tip 10: Slice Function
Extract a range of characters from the middle of a text string
slice(outputs('String_Input'),101,108)
Tip 11: Split Function
Split a text string into an array of values by specifying a delimiter
split(outputs('String_Input'),'.')
Tip 12: Substring Function
Extracts a substring given number of characters from the middle of a supplied text string
substring(outputs('String_Input'),101,7)
Tip 13: Trim Function
Removes blank spaces from the start and the end of a text string
trim(outputs('String_Input'))
Wield the magic of Power Automate
As you wield your digital wand, remember that each function is a spell waiting to be cast. The CONCAT spell weaves disparate strings into a harmonious melody, while the ENDSWITH charm discerns truth from illusion at the tale’s end
Illusions Demystified:
- Slice:
If startIndex is greater than the string length, it returns an empty string.
If endIndex isn’t specified or greater than the string length, it takes up to the end of the string.
If startIndex or endIndex is negative, it calculates the index value as the sum of the string length and the Index and then calculates accordingly. Bet you did not know that.
slice(outputs('String_Input'),-100)
The text position for "gments. Whether" is 397
The length is 497 and hence the Slice -100 would start from ( -100+397)