How To Reverse A String In UiPath

Reversing a text is something that we come across most of the time in our processes.

Let’s see how to do it using a simple code…

String reversedString = stringtoBeReversed.AsEnumerable.Reverse.ToArray

Note:
1.Simply replace the “stringToBeReveresed” with your required “string”
2.It returns an array of char

and then

string.Join(“”,reverseString)

Note:
1.Here we are converting an array of char to string type
2.Here “” indicates the separator


Example

Implementation using UiPath :

Let us implement a workflow which takes “SharathRaju” as input and outputs the reverse of it i.e. “ujaRhtarahS

Step 1:
Drag “Assign” activity into the design panel and pass a value to it.

UiPath Reverse a string 1.PNG

Step 2:
Drag “Assign” activity into the design panel and obtain an array of char in reverse order by using the above-mentioned 1st code.

UiPath Reverse a string 2

Step 3:
Drag “Message Box” activity into the design panel and obtain the reverse by using the above-mentioned 2nd code.

UiPath Reverse a string 3.PNG

Step 4:
Final Output!!!

UiPath Reverse a string 4.PNG

Click here to download the Source Code…

Hope it has helped you… 

Advertisements

Author: Sharath Raju

Founder@www.ExcelCult.com

Leave a Reply