Kumar AU

Kumar AU

  • 1.4k
  • 309
  • 60k

Reading the file with line Position, its getting added leading zeros

Dec 13 2020 11:17 AM
I have File which has many lines related to bank account details. So while reading the file, sometimes the Account Number field is getting assigned with leading 0's as shown in this number 123456782135435000. Could you please suggest me how can I avoid leading 0's ?
the Exact Number should be - 123456782135435 but Most of the time account number will be in 16 characters. For example like this : 6689161615476256
This is the exsiting code where I am reading the line position in a file for the accountNumber
var accountNumber = Line.Substring(52, 16);
NewFileLine =
showToken => Line.Replace(Line.Substring(52, 16), showToken.PadRight(16))
Kindly let me know , how do I avoid the leading Zero's for the account number.

Answers (4)