How to remove text, from the left or right, by specifying the number of characters.(Power Automate Desktop)
Learn how to delete text from the left or right by specifying the number of characters.
Overall flow
Robin(for copy and paste)
It can be copied and pasted into Power Automate Desktop.
SET Text TO $'''abcde''' SET DeleteLength TO 2 IF DeleteLength < Text.Length THEN Text.GetSubtext.GetSubtextFrom Text: Text CharacterPosition: DeleteLength Subtext=> Subtext Text.GetSubtext.GetSubtextFromStartTo Text: Text NumberOfChars: Text.Length - DeleteLength Subtext=> Subtext2 END
Steps
First, prepare variables.
Variable | Name(Example) |
---|---|
Target text. | %Text% |
Number of characters to delete. | %DeleteLength% |
Next, put in place an "If" to check for errors.
Parameter | Value |
---|---|
First operand | %DeleteLength% |
Operator | Less than (<) |
Second operand | %Text.Length% |
Put in place "Get Subtext" in "If".
To remove from the left, set the following.
Parameter | Value |
---|---|
Original text | %Text% |
Start Index | Character position |
Character position | %DeleteLength% |
Length | End of text |
To remove from the right, set the following.
Parameter | Value |
---|---|
Original text | %Text% |
Start Index | Start of text |
Length | Number of chars |
Number of chars | %Text.Length - DeleteLength% |
When the subflow to run, the text of the deleted result is set to the variable produced in "Get Subtext".
For those who want to learn Power Automate Desktop effectively
The information on this site is now available in an easy-to-read e-book format.
Or Kindle Unlimited (unlimited reading).
You willl discover how to about basic operations.
By the end of this book, you will be equipped with the knowledge you need to use Power Automate Desktop to streamline your workflow.
Discussion
New Comments
No comments yet. Be the first one!