Skip to content

Instantly share code, notes, and snippets.

@shaselton
Created March 26, 2016 22:25
Show Gist options
  • Save shaselton/10d45a3aa328227ff137 to your computer and use it in GitHub Desktop.
Save shaselton/10d45a3aa328227ff137 to your computer and use it in GitHub Desktop.
Weekly Challenges 3-26-16
def leftpad(str, len, ch = '')
return str if str.size >= len
(Array.new(len - str.size, ch) + str.split('')).join('')
end
puts leftpad('hello', 10, 'w')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment