るりまサーチ

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

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. dh p
  5. rsa p

ライブラリ

キーワード

検索結果

<< < ... 3 4 5 6 7 ... > >>

String#casecmp(other) -> -1 | 0 | 1 | nil (6102.0)

String#<=> と同様に文字列の順序を比較しますが、 アルファベットの大文字小文字の違いを無視します。

...
String
#<=> と同様に文字列の順序を比較しますが、
アルファベットの大文字小文字の違いを無視します。

このメソッドの動作は組み込み変数 $= には影響されません。


@param other self と比較する文字列

//emlist[例][ruby]{
"aBcDe...
...F".casecmp("abcde") #=> 1
"aBcDeF".casecmp("abcdef") #=> 0
"aBcDeF".casecmp("abcdefg") #=> -1
"abcdef".casecmp("ABCDEF") #=> 0
//}

nil は文字列のエンコーディングが非互換の時に返されます。

//emlist[][ruby]{
"\u{e4 f6 fc}".encode("ISO-8859-1").casecmp("\u{c4 d6...
...dc}") #=> nil
//}

@see String#<=>, Encoding.compatible?...
...
String
#<=> と同様に文字列の順序を比較しますが、
アルファベットの大文字小文字の違いを無視します。

このメソッドの動作は組み込み変数 $= には影響されません。

String
#casecmp? と違って大文字小文字の違いを無視するの...
...nicode 全体ではなく、A-Z/a-z だけです。

@param other self と比較する文字列

//emlist[例][ruby]{
"aBcDeF".casecmp("abcde") #=> 1
"aBcDeF".casecmp("abcdef") #=> 0
"aBcDeF".casecmp("abcdefg") #=> -1
"abcdef".casecmp("ABCDEF") #=> 0
//}

nil は文字列のエンコ...
...ーディングが非互換の時に返されます。

//emlist[][ruby]{
"\u{e4 f6 fc}".encode("ISO-8859-1").casecmp("\u{c4 d6 dc}") #=> nil
//}

@see String#<=>, Encoding.compatible?...

String#casecmp?(other) -> bool | nil (6102.0)

大文字小文字の違いを無視し文字列を比較します。 文字列が一致する場合には true を返し、一致しない場合には false を返します。

...lse を返します。

@param other self と比較する文字列

//emlist[例][ruby]{
"abcdef".casecmp?("abcde") #=> false
"aBcDeF".casecmp?("abcdef") #=> true
"abcdef".casecmp?("abcdefg") #=> false
"abcdef".casecmp?("ABCDEF") #=> true
"\u{e4 f6 fc}".casecmp?("\u{c4 d6 dc}") #=> tr...
...ue
//}

nil は文字列のエンコーディングが非互換の時に返されます。

//emlist[][ruby]{
"\u{e4 f6 fc}".encode("ISO-8859-1").casecmp?("\u{c4 d6 dc}") #=> nil
//}

@see String#casecmp...

String#chop! -> self | nil (6102.0)

文字列の最後の文字を取り除きます。 ただし、終端が "\r\n" であればその 2 文字を取り除きます。

...@return chop! は self を変更して返しますが、取り除く文字がなかった場合は nil を返します。

//emlist[例][ruby]{
str = "string\r\n"
ret = str.chop!
ret # => "string"
str # => "string"
str.chop! # => "strin"
"".chop!...
...# => nil
//}

@see String#chomp!
@see String#chop...
...# => nil
//}

@see String#chomp!
@see String#chop
@see String#delete_suffix!...

String#codepoints -> [Integer] (6102.0)

文字列の各コードポイントの配列を返します。(self.each_codepoint.to_a と同じです)

...ch_codepoint.to_a と同じです)

//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".codepoints
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
//}

ブロックが指定された場合は String#each_codepoint と同じように動作します。

Ruby 2.6 までは deprecated...
...の警告が出ますが、Ruby 2.7 で警告は削除されました。

@see String#each_codepoint...

String#each_codepoint -> Enumerator (6102.0)

文字列の各コードポイントに対して繰り返します。

...ます。

//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
"hello わーるど".encode('euc-jp').each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 42223, 41404, 42219, 42185]
//}

@see String#codepoints...

絞り込み条件を変える

String#each_grapheme_cluster -> Enumerator (6102.0)

文字列の書記素クラスタに対して繰り返します。

...

String
#each_char と違って、
Unicode Standard Annex #29 (https://unicode.org/reports/tr29/)
で定義された書記素クラスタに対して繰り返します。

//emlist[例][ruby]{
"a\u0300".each_char.to_a.size # => 2
"a\u0300".each_grapheme_cluster.to_a.size # => 1
//}

@see String#grap...

String#empty? -> bool (6102.0)

文字列が空 (つまり長さ 0) の時、真を返します。

...文字列が空 (つまり長さ 0) の時、真を返します。

//emlist[例][ruby]{
"hello".empty? #=> false
" ".empty? #=> false
"".empty? #=> true
//}...

String#grapheme_clusters -> [String] (6102.0)

文字列の書記素クラスタの配列を返します。(self.each_grapheme_cluster.to_a と同じです)

...を返します。(self.each_grapheme_cluster.to_a と同じです)

//emlist[例][ruby]{
"a\u0300".grapheme_clusters # => ["à"]
//}

ブロックが指定された場合は String#each_grapheme_cluster と同じように動作します。

Ruby 2.6 までは deprecated の警告が出ますが、...
...Ruby 2.7 で警告は削除されました。

@see String#each_grapheme_cluster...

String#pathmap_explode -> Array (6102.0)

自身をパスを表す部分ごとに分解して配列にして返します。 String#pathmap で利用される protected メソッドです。

...自身をパスを表す部分ごとに分解して配列にして返します。
String
#pathmap で利用される protected メソッドです。

@see String#pathmap...

String#prepend(*arguments) -> String (6102.0)

複数の文字列を先頭に破壊的に追加します。

...複数の文字列を先頭に破壊的に追加します。

@param arguments 追加したい文字列を指定します。

//emlist[例][ruby]{
a = "!!!"
a.prepend # => "!!!"
a # => "!!!"

a = "!!!"
a.prepend "hello ", "world" # => "hello world!!!"
a # => "hello...

絞り込み条件を変える

<< < ... 3 4 5 6 7 ... > >>