るりまサーチ

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

別のキーワード

  1. string encode
  2. _builtin encode
  3. string encode!
  4. base64 encode64
  5. _builtin encode!

クラス

キーワード

検索結果

<< < 1 2 >>

IO#set_encoding(ext_enc) -> self (9.0)

IO のエンコーディングを設定します。

...で外部エンコーディングを内部エンコーディングに変換する際の
オプションを指定します。
詳しくは String#encode を参照してください。

@param enc_str エンコーディングを表す文字列を指定します。"A:B" のようにコロンで区切...

IO#set_encoding(ext_enc, int_enc, **opts) -> self (9.0)

IO のエンコーディングを設定します。

...で外部エンコーディングを内部エンコーディングに変換する際の
オプションを指定します。
詳しくは String#encode を参照してください。

@param enc_str エンコーディングを表す文字列を指定します。"A:B" のようにコロンで区切...

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

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

...=> 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?...
...#=> 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 (9.0)

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

...false
"abcdef".casecmp?("ABCDEF") #=> true
"\u{e4 f6 fc}".casecmp?("\u{c4 d6 dc}") #=> true
//}

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

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

@see String#casecmp...

String#each_codepoint -> Enumerator (9.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_codepoint {|codepoint| block } -> self (9.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#encoding -> Encoding (9.0)

文字列のエンコーディング情報を表現した Encoding オブジェクトを返します。

...列のエンコーディング情報を表現した Encoding オブジェクトを返します。

//emlist[例][ruby]{
# encoding: utf-8
utf8_str = "test"
euc_str = utf8_str.encode("EUC-JP")
utf8_str.encoding # => #<Encoding:UTF-8>
euc_str.encoding # => #<Encoding:EUC-JP>
//}

@see Encoding...

Symbol#casecmp(other) -> -1 | 0 | 1 | nil (9.0)

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

...ボルではない場合や、文字列のエンコーディングが非互換の場合は、nil を返します。

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

@see String#casecmp, Symbol#<=>, Symbol#casecmp?...

Symbol#casecmp?(other) -> bool | nil (9.0)

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

...er がシンボルではない場合や、文字列のエンコーディングが非互換の場合は、nil を返します。

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

@see String#casecmp?, Symbol#casecmp...
<< < 1 2 >>