Substring from Right to left

Hi Team,

I have multiple string with date Eg. “ABC_26022021”, “ABCD_06022021”,“DEFE_02022021” I want to do substring from right to left indexing(0,10) and remaining value I want to store in diff. Variable. like
“ABCD_06022021” - Input and “AB” is new value
“DEFE_02022021”- input and “DE” is new value
“ABC_26022021” - input and “A” is new value
make sure i want to do substring of right to left side of (0,10)

1 Like

Hello @Pramod_Sharma ,

Try like this strVar= “ABCD_06022021”.Substring(0,2)

Cheers

I want from right to left if i put value “ABC_20102021” it will give me an out put “AB” but i want out put only “A”

@Pramod_Sharma

In this case you can check with the length of the string and keeping IF condition, check as below

Hope this helps you

Thanks

2 Likes

Check this single line of code, @Pramod_Sharma
System.Text.RegularExpressions.Regex.Match(“ABC_20102021”,"(.*).{11}.*$").Groups(1)
Hope this may help you :slight_smile:

Hey @Pramod_Sharma
Step1: get the input
Step2:use right function to get elements from right to left
ex:rightfunction(variable)=Right(input, 10)

Refer this to know about right function

Step3:use another assign activity and remove the elements which is get from rightfunction.
Then print the result.
This may be work out😊

1 Like