Adds a number of strings so that it satisfies the rules for the number of characters

I have a number of datatables containing account numbers. This account number must be tidied up before being processed. The rule is

  1. The number of characters must be 13 digits
  2. If less than 13 digits, 0 must be added so that the number of characters becomes 13

example:
a. 4000006201 == 10 digits, so it becomes 0004000006201

b. 1234000006201== 13 digits, no need to edit again

c. 400000622 == 9 digits, so it becomes 0000400000622

How to do this in studio. Anyone who can help me would greatly appreciate it. Thank you

Hi,

In this case, we can use PadLeft method as the following.

CurrentRow("Account Number") = CurrentRow("Account Number").ToString.PadLeft(13,"0"c)

Sample20230307-3L.zip (2.8 KB)

Regards,

1 Like

Hi @llayla

Give a try with

inputString.PadLeft(13, "0"c)

Regards

Wow, thank you so much @Yoichi , it really help me :+1:

1 Like

Thank you so much @fernando_zuluaga for your help :+1: :+1:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.