How to remove a certain number of characters from the end of a string value in Microsoft Power Automate (Flow).
A quick guide on how to quickly cut characters from a string value in a Flow.
1. Initial Situation
Let’s say we have a dynamic content string value where we want to remove the last three characters.
An example for this would be a date where we don’t want the days, only year and months.
So basically turn this:
To do this, we need to remove -06 from the first string.
The Expression we use, to get rid of a certain amount of characters at the end of a string is the following:
Let’s replace STRING in the above Expression with our dynamic content from the flow.
In our case, that’s the Compose – Date action.
If you want to remove, let’s say, 5 characters instead of only 3, just change the number 3 at the end of the Expression to 5. Like this:
The flow now looks like this:
When we now run the flow, we get the following result:
As you can see, the – sign and the days have been removed from the string value.