Created
December 2, 2011 04:04
-
-
Save zachwill/1421705 to your computer and use it in GitHub Desktop.
CoffeeScript zfill
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String::zfill ||= (padding) -> | |
| string = this | |
| while string.length < padding | |
| string = '0' + string | |
| string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment