るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< < ... 6 7 8 9 10 ... > >>

String#center(width, padding = &#39; &#39;) -> String (9127.0)

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

...idth 返り値の文字列の最小の長さ
@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...

String#ljust(width, padding = &#39; &#39;) -> String (9127.0)

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

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

@see String#center, String#rjust...

String#lstrip -> String (9127.0)

文字列の先頭にある空白文字を全て取り除いた新しい文字列を返します。 空白文字の定義は " \t\r\n\f\v\0" です。

...にある空白文字を全て取り除いた新しい文字列を返します。
空白文字の定義は " \t\r\n\f\v\0" です。

//emlist[例][ruby]{
p " abc\n".lstrip #=> "abc\n"
p "\t abc\n".lstrip #=> "abc\n"
p "abc\n".lstrip #=> "abc\n"
//}

@see String#strip, String#rstrip...

String#rjust(width, padding = &#39; &#39;) -> String (9127.0)

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

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

@see String#center, String#ljust...

String#rstrip -> String (9127.0)

文字列の末尾にある空白文字を全て取り除いた新しい文字列を返します。 空白文字の定義は " \t\r\n\f\v\0" です。

...[例][ruby]{
p " abc\n".rstrip #=> " abc"
p " abc \t\r\n\0".rstrip #=> " abc"
p " abc".rstrip #=> " abc"
p " abc\0 ".rstrip #=> " abc"

str = "abc\n"
p str.rstrip #=> "abc"
p str #=> "abc\n" (元の文字列は変化しない)
//}

@see String#lstr...

絞り込み条件を変える

String#strip -> String (9127.0)

文字列先頭と末尾の空白文字を全て取り除いた文字列を生成して返します。 空白文字の定義は " \t\r\n\f\v\0" です。

...尾の空白文字を全て取り除いた文字列を生成して返します。
空白文字の定義は " \t\r\n\f\v\0" です。

//emlist[例][ruby]{
p " abc \r\n".strip #=> "abc"
p "abc\n".strip #=> "abc"
p " abc".strip #=> "abc"
p "abc".strip #=> "abc"
p "...
...\0 abc \0".strip #=> "abc"

str = "\tabc\n"
p str.strip #=> "abc"
p str #=> "\tabc\n" (元の文字列は変化しない)
//}

@see String#lstrip, String#rstrip...

String#undump -> String (9127.0)

self のエスケープを戻したものを返します。

...self のエスケープを戻したものを返します。

String
#dump の逆変換にあたります。

//emlist[例][ruby]{
"\"hello \\n ''\"".undump #=> "hello \n ''"
//}

@see String#dump...

String#unicode_normalize(form = :nfc) -> String (9127.0)

self を NFC、NFD、NFKC、NFKD のいずれかの正規化形式で Unicode 正規化し た文字列を返します。

...ングであった場合は一度 UTF-8 に変
換してから正規化されるため、UTF-8 よりも遅くなっています。

//emlist[例][ruby]{
"a\u0300".unicode_normalize # => 'à' ("\u00E0" と同じ)
"a\u0300".unicode_normalize(:nfc) # => 'à' ("\u00E0" と同じ)
"\u00E0".unico...
...de_normalize(:nfd) # => 'à' ("a\u0300" と同じ)
"\xE0".force_encoding('ISO-8859-1').unicode_normalize(:nfd)
# => Encoding::CompatibilityError raised
//}

@see String#unicode_normalize!, String#unicode_normalized?...

String#scrub -> String (9123.0)

self が不正なバイト列を含む場合に別の文字列に置き換えた新しい文字列を返します。

...
ロックの戻り値で置き換えられます。

//emlist[例][ruby]{
"abc\u3042\x81".scrub # => "abc\u3042\uFFFD"
"abc\u3042\x81".scrub("*") # => "abc\u3042*"
"abc\u3042\xE3\x80".scrub{|bytes| '<'+bytes.unpack('H*')[0]+'>' } # => "abc\u3042<e380>"
//}

@see String#scrub!...
<< < ... 6 7 8 9 10 ... > >>