るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.170秒)

別のキーワード

  1. open3 popen2e
  2. socket af_e164
  3. matrix det_e
  4. open3 capture2e
  5. matrix rank_e

ライブラリ

クラス

検索結果

String#center(width, padding = ' ') -> String (24250.0)

長さ width の文字列に self を中央寄せした文字列を返します。 self の長さが width より長い時には元の文字列の複製を返します。 また、第 2 引数 padding を指定したときは 空白文字の代わりに padding を詰めます。

...長さ width の文字列に self を中央寄せした文字列を返します。
self の長さが width より長い時には元の文字列の複製を返します。
また、第 2 引数 padding を指定したときは
空白文字の代わりに padding を詰めます。

@param width...
...なるまで self の両側に詰める文字

//emlist[例][ruby]{
p "foo".center(10) # => " foo "
p "foo".center(9) # => " foo "
p "foo".center(8) # => " foo "
p "foo".center(7) # => " foo "
p "foo".center(3) # => "foo"
p "foo".center(2) # =>...
..."foo"
p "foo".center(1) # => "foo"
p "foo".center(10, "*") # => "***foo****"
//}

@see String#ljust, String#rjust...