{"id":10,"date":"2012-06-26T20:25:28","date_gmt":"2012-06-26T14:25:28","guid":{"rendered":"http:\/\/www.marksdev.net\/?p=10"},"modified":"2012-06-27T17:14:07","modified_gmt":"2012-06-27T11:14:07","slug":"padding-a-string-with-leading-zeros","status":"publish","type":"post","link":"http:\/\/www.marksdev.net\/?p=10","title":{"rendered":"Padding a string with leading zeros"},"content":{"rendered":"<p>Started the new job here and I was going through the code with the boss of the developers and found a couple of interesting things that I said could be sorted out with a lot short notation. One of the things that I spotted was his looping through something and adding zero&#8217;s to the start of it.<\/p>\n<p>I mentioned that it could be sorted our with a single line of code&#8230; he was amazed that you could do that.<\/p>\n<p>So here is the code:<\/p>\n<pre lang=\"asp\" line=\"1\">response.write Right(String(4,\"0\") &amp; n, 4)<\/pre>\n<p>This is of course done in Classic ASP. All it does is create a string of length 4 and then append the number (n) at the end&#8230; easy.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Started the new job here and I was going through the code with the boss of the developers and found a couple of interesting things that I said could be sorted out with a lot short notation. One of the things that I spotted was his looping through something and adding zero&#8217;s to the start [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[6,5],"tags":[],"_links":{"self":[{"href":"http:\/\/www.marksdev.net\/index.php?rest_route=\/wp\/v2\/posts\/10"}],"collection":[{"href":"http:\/\/www.marksdev.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.marksdev.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.marksdev.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.marksdev.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10"}],"version-history":[{"count":5,"href":"http:\/\/www.marksdev.net\/index.php?rest_route=\/wp\/v2\/posts\/10\/revisions"}],"predecessor-version":[{"id":16,"href":"http:\/\/www.marksdev.net\/index.php?rest_route=\/wp\/v2\/posts\/10\/revisions\/16"}],"wp:attachment":[{"href":"http:\/\/www.marksdev.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.marksdev.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.marksdev.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}