title: What is the easiest way to pad a string with 0 to the left?
body: <p>What is the easiest way to pad a string with 0 to the left so that</p>
  
  <ul>
  <li><p>"110" = "00000110"</p></li>
  <li><p>"11110000" = "11110000"</p></li>
  </ul>
  
  <p>I have tried to use the <code>format!</code> macro but it only pads to the right with space:</p>
  
  <pre><code>format!("{:08}", string);
  </code></pre>