るりまサーチ

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

別のキーワード

  1. etc sc_xopen_enh_i18n
  2. pop n_bytes
  3. rsa n=
  4. rsa n
  5. pop3 n_bytes

ライブラリ

クラス

検索結果

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

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

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

@param width...
...@param padding 長さが 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...