Skip to content

Instantly share code, notes, and snippets.

@zachwill
Created December 2, 2011 04:04
Show Gist options
  • Select an option

  • Save zachwill/1421705 to your computer and use it in GitHub Desktop.

Select an option

Save zachwill/1421705 to your computer and use it in GitHub Desktop.
CoffeeScript zfill
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