diff options
| author | Burdette Lamar <BurdetteLamar@Yahoo.com> | 2025-08-26 13:23:33 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-26 14:23:33 -0400 |
| commit | bb9116281ba8bc9e9d1bf0c72e75bea79cf0f89b (patch) | |
| tree | 312ccbb8d80dc7696c1512bf833c324c0bf9932c /doc | |
| parent | d113bc5a6d5eb553f076a2f5dfdc974e63ea78da (diff) | |
[DOC] Tweaks for String#ljust
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/string/ljust.rdoc | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/doc/string/ljust.rdoc b/doc/string/ljust.rdoc index 8e23c1fc8f..f37c0b3151 100644 --- a/doc/string/ljust.rdoc +++ b/doc/string/ljust.rdoc @@ -1,16 +1,14 @@ -Returns a left-justified copy of +self+. - -If integer argument +size+ is greater than the size (in characters) of +self+, -returns a new string of length +size+ that is a copy of +self+, -left justified and padded on the right with +pad_string+: +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) # => "тест " - 'こんにちは'.ljust(10) # => "こんにちは " + 'こんにちは'.ljust(10) # => "こんにちは " -If +size+ is not greater than the size of +self+, returns a copy of +self+: +If <tt>width <= self.length</tt>, returns a copy of +self+: 'hello'.ljust(5) # => "hello" - 'hello'.ljust(1) # => "hello" + 'hello'.ljust(1) # => "hello" # Does not truncate to width. + +Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String]. |
