Leading zeroes

I have numbers to put out on debug.print, or even in a text box…but want them to always have the same number of digits.

example:

12345 shows as 12345
456 shows as 00456
27 shows as 00027

how to do this? I tried F5 and get 27.00000 D5 does not function (crashes)


{
  int tutu = 12345;
  Debug.Print(PadLeft(tutu));
  tutu = 456;
  Debug.Print(PadLeft(tutu));
  tutu = 27;
  Debug.Print(PadLeft(tutu));
  tutu = 3;
  Debug.Print(PadLeft(tutu));
}

        private static string PadLeft(int pInteger)
        {
            string StrTmp = "0000" + pInteger.ToString();
            return StrTmp.Substring(StrTmp.Length - 5);
        }

Does this help ?

Edit: simplified for this particular use, with 5 digits requested.

Thanks…I was unaware that Substring was included in .netmf, since most things are not…would be nice to have an alphabetical list of what’s in there.