title: How to pad an integer number with leading zeros?
body: <p>I have strings that are being converted that need to be four characters
  long. The values are coming in as anywhere between 0 and 4 characters long.
  I need to pad the strings with zeros to make all IDs 4 characters long:</p>
  
  <p>Example</p>
  
  <p>Input number Need</p>
  
  <pre><code>1  =&gt; 0001
  121 =&gt; 0121
  0567 =&gt; 0567
  </code></pre>
  
  <p>So far I have tried:</p>
  
  <pre><code>int temCode = 0; 
  DataTable dt = objSites.Get_Max_SiteCode();
  if (dt.Rows.Count &gt; 0)
  { 
       string siteCode = dt.Rows[0]["SiteCode"].ToString();
       string code = siteCode.Substring(siteCode.Length - 4);
       temCode = Convert.ToInt32(code) + 1;
       temCode.ToString().PadLeft(4, '0'); // same number is coming here without any pad left.
  }
  </code></pre>