るりまサーチ (Ruby 2.6.0)

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

別のキーワード

  1. _builtin compatible?
  2. encoding compatible?
  3. _builtin ascii_compatible?
  4. encoding ascii_compatible?

検索結果

Encoding.compatible?(obj1, obj2) -> Encoding | nil (54307.0)

2つのオブジェクトのエンコーディングに関する互換性をチェックします。 互換性がある場合はそのエンコーディングを、 ない場合は nil を返します。

2つのオブジェクトのエンコーディングに関する互換性をチェックします。
互換性がある場合はそのエンコーディングを、
ない場合は nil を返します。

引数が両方とも文字列である場合、互換性があるならば
その文字列を結合できます。この場合返り値のエンコーディングは
結合した文字列が取るであろう Encoding オブジェクトを返します。

//emlist[例][ruby]{
Encoding.compatible?("\xa1".force_encoding("iso-8859-1"), "b")
#=> #<Encoding:ISO-8859-1>

Encoding.compatible?...

Encoding#ascii_compatible? -> bool (18346.0)

自身が ASCII 互換のエンコーディングである場合真返します。 そうでない場合は偽を返します。

自身が ASCII 互換のエンコーディングである場合真返します。
そうでない場合は偽を返します。


//emlist[例][ruby]{
Encoding::UTF_8.ascii_compatible? #=> true
Encoding::UTF_16BE.ascii_compatible? #=> false
//}