How to remove text, from the left or right, by specifying the number of characters.(Power Automate Desktop)

Japanese version.

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.

VariableName(Example)
Target text.%Text%
Number of characters to delete.%DeleteLength%

Next, put in place an "If" to check for errors.

ParameterValue
First operand%DeleteLength%
OperatorLess than (<)
Second operand%Text.Length%

Put in place "Get Subtext" in "If".

To remove from the left, set the following.

ParameterValue
Original text%Text%
Start IndexCharacter position
Character position%DeleteLength%
LengthEnd of text

To remove from the right, set the following.

ParameterValue
Original text%Text%
Start IndexStart of text
LengthNumber 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.

Links

Tips(Power Automate Desktop)