You will need the String.PadLeft method, which aligns the string to the right. If the length is less than one of the numbers you give PadLeft, this will not change the value.
public string ZeroFill(int number, int length)
return number.ToString().PadLeft(length, '0');
}
source
share