title: Ruby-like Question: Make this function shorter (ActionScript 3)
body: <p>I just wrote this incredibly verbose code to turn numbers like 2 into 02. <strong>Can you make this function shorter, please (maintaning the functionality)?</strong></p>
  
  <pre><code>    public static function format(n:int, minimumLength:int):String {
          var retVal:String = n.toString();
          var stillNeed:int = minimumLength - retVal.length;
          for (var i:int = 0; i &lt; stillNeed; i++) {
              retVal = "0" + retVal;
          }
          return retVal;
      }
  </code></pre>
  
  <p>Please use types for variables. Extra points (good-vibe points, not SO points) if there's already a built-in function that I don't know about. </p>
  
  <p>If anybody wants to post some extremely short equivalent in some other language, that would be fun too.</p>