Lucene.Net.Search.BaseTestRangeFilter.Pad C# (CSharp) Method

Pad() public static method

a simple padding function that should work with any int
public static Pad ( int n ) : string
n int
return string
        public static string Pad(int n)
        {
            StringBuilder b = new StringBuilder(40);
            string p = "0";
            if (n < 0)
            {
                p = "-";
                n = int.MaxValue + n + 1;
            }
            b.Append(p);
            string s = Convert.ToString(n);
            for (int i = s.Length; i <= IntLength; i++)
            {
                b.Append("0");
            }
            b.Append(s);

            return b.ToString();
        }