Greggy
(Greggy O)
October 18, 2022, 9:02am
1
Hi everyone, hope anyone of this thread can help me. I have a variable strMasked = 123456789012 , I want to convert the first few characters with “X” and retain the last the four digits as is. The output should be XXXXXXXX9012.
Apparently this is my code strMasked = right(dtExcelValue.Rows(intRowCounter).Item(“Settlement Account No.”).ToString.Replace(“strMasked”,“X”),4)
but the output I’m getting is only 9012. I want the output to be XXXXXXXX9012
Thank you.
Hello @Greggy
You need to use padleft to add x to the value.
strMasked = right(dtExcelValue.Rows(intRowCounter).Item(“Settlement Account No.”).ToString.Replace(“strMasked”,“X”),4)
strMasked=strMasked.padleft(12,“X”)
Hi,
I have a number of IDs that can be various lengths however, I need to add 0s at the start of the ID so that the final length is 14 digits long. For example:
1234 would need to be 00000000001234
456789 would need to be 00000000456789
Is there a simple way to do this?
The theory in my head was to get the length of the initial string given. If its less than 14, add another zero at the start, then check again… but that seems a bit clunky. Is there a nicer way to do this?
Thanks
Thanks
ppr
(Peter Preuss)
October 18, 2022, 9:18am
3
Strings.Right(dtExcelValue.Rows(intRowCounter).Item("Settlement Account No.").ToString,4).PadLeft(12,"X"c)
1 Like
Greggy
(Greggy O)
October 19, 2022, 2:51am
4
Thank you so much @ppr for your help, how about if the first few characters are dynamic? like what if the first row has 16 digits while the second row has only 12 and I want the last four to be shown while the first few characters will be replaced by ‘X’?
Greggy
(Greggy O)
October 19, 2022, 2:51am
5
Thanks @Rahul_Unnikrishnan for your help!
Gokul001
(Gokul Balaji)
October 19, 2022, 4:41am
6
HI @Greggy
How about this expression?
Strings.Right("123456789",4).PadLeft(CInt("123456789").ToString.count,"X"c)
Regards
Gokul
2 Likes
Gokul001
(Gokul Balaji)
October 19, 2022, 5:54am
7
If you don’t have any queries, Kindly close this topic by mark as solved @Greggy
Forum FAQ - How to mark a post as a solution
This document is part of our beginners guide .
This article will teach you how to properly mark a post as a solution.
We were closely following our last UiPath Forum feedback round! topic and carefully extracted all the bits of feedback that was provided. As such, we would like to tackle the topic of solutions on our Forum and how to properly use them.
When is the topic resolved?
The topic can be considered resolved when the topic author has fo…
Regards
Gokul
1 Like
ppr
(Peter Preuss)
October 19, 2022, 8:08am
8
as also mentioned, then we make use of the string length from the origin value
strOld = dtExcelValue.Rows(intRowCounter).Item("Settlement Account No.").ToString.Trim
strNew = Strings.Right(strOld ,4).PadLeft(strOld.Length,"X"c)
system
(system)
Closed
October 26, 2022, 6:09am
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.