How to leave text with a specified number of characters from the left or right.(Power Automate Desktop)

Japanese version.

Learn how to leave text from the left or right with a specified 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 LeaveLength TO 2
IF LeaveLength <= Text.Length THEN
    Text.GetSubtext.GetSubtextFromStartTo Text: Text NumberOfChars: LeaveLength Subtext=> Subtext
    Text.GetSubtext.GetSubtextFrom Text: Text CharacterPosition: Text.Length - LeaveLength Subtext=> Subtext2
END

Steps

First, prepare variables.

VariableName(Example)
Target text.%Text%
Number of characters to leave.%LeaveLength%

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

ParameterValue
First operand%LeaveLength%
OperatorLess than or equal to (<=)
Second operand%Text.Length%

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

To leave from the left, set the following.

ParameterValue
Original text%Text%
Start IndexStart of text
LengthNumber of chars
Number of chars%LeaveLength%

To remove from the right, set the following.

ParameterValue
Original text%Text%
Start IndexCharacter position
Character position%Text.Length - LeaveLength%
LengthEnd of text

When the subflow to run, the text of the 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)