Skip to content

Instantly share code, notes, and snippets.

@masak
Created March 23, 2009 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masak/83548 to your computer and use it in GitHub Desktop.
Save masak/83548 to your computer and use it in GitHub Desktop.
----------------------------------------------------------- String#ljust
str.ljust(integer, padstr=' ') => new_str
------------------------------------------------------------------------
If _integer_ is greater than the length of _str_, returns a new
+String+ of length _integer_ with _str_ left justified and padded
with _padstr_; otherwise, returns _str_.
"hello".ljust(4) #=> "hello"
"hello".ljust(20) #=> "hello "
"hello".ljust(20, '1234') #=> "hello123412341234123"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment