muthuppm
(Muthu)
February 16, 2018, 5:55am
1
I am new to UIPath Automation. Looking for assistance on the below query.
I have a string variable of 100 chars and wanted update specific position(say Start Position: 11, Length:10) with the derived value.
Tried using the combination of keywords substring and replace. But nothing worked.
InputString = “C1010111COxxxxxxxxxxDANIEL MICHELLE ON 68GS63”
Derived value = “HOUSEHOLD”
Want xxxxxxxxxx to be updated with Derived value.
OutputString = “C1010111COHOUSEHOLD DANIEL MICHELLE ON 68GS63”
Hemanth
(Hemachandiran K)
February 16, 2018, 6:24am
2
Hi @muthuppm ,
Try the following Command,
InputString.Replace(InputString.substring(10,10),Derived value)
Regards,
1 Like
muthuppm
(Muthu)
February 16, 2018, 6:37am
3
Thanks for update Hemanth.
If my InputString happens to be “C1010111COxxxxxxxxxxDANIEL MICHELLE ON 68GS63xxxxxxxxxx”, then Output String will become “C1010111COHOUSEHOLDDANIEL MICHELLE ON 68GS63HOUSEHOLD”.
The second instance of xxxxxxxxxx should not be updated with HOUSEHOLD
Hemanth
(Hemachandiran K)
February 16, 2018, 7:09am
4
Okey @muthuppm ,
Then we go with Regex
regexVar=new regex(InputString.subString(10,10))
regexVar.replace(InputString,Derived Value,1)
Its working fine for me.
Regards,
1 Like
MAHESH1
(MAHESHKUMAR JV)
February 16, 2018, 7:42am
5
@muthuppm
If your input string will always have 10 X’s then you can use like this.
Inputstring.Replace(“xxxxxxxxxx”,Derived Value)
Regards,
Mahesh