diff options
Diffstat (limited to 'doc/string/ljust.rdoc')
| -rw-r--r-- | doc/string/ljust.rdoc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/string/ljust.rdoc b/doc/string/ljust.rdoc new file mode 100644 index 0000000000..a8ca62ee76 --- /dev/null +++ b/doc/string/ljust.rdoc @@ -0,0 +1,13 @@ +Returns a copy of +self+, left-justified and, if necessary, right-padded with the +pad_string+: + + 'hello'.ljust(10) # => "hello " + ' hello'.ljust(10) # => " hello " + 'hello'.ljust(10, 'ab') # => "helloababa" + 'こんにちは'.ljust(10) # => "こんにちは " + +If <tt>width <= self.length</tt>, returns a copy of +self+: + + 'hello'.ljust(5) # => "hello" + 'hello'.ljust(1) # => "hello" # Does not truncate to width. + +Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String]. |
