るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.462秒)
トップページ > クエリ:i[x] > クエリ:_encoding[x] > クエリ:fixed_encoding?[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

検索結果

Regexp#fixed_encoding? -> bool (30374.0)

正規表現が任意の ASCII 互換エンコーディングとマッチ可能な時に false を返します。

...任意の ASCII 互換エンコーディングとマッチ可能な時に false を返します。

//emlist[例][ruby]{
# -*- coding:utf-8 -*-

r = /a/
r.fixed_encoding? # => false
r.encoding # => #<Encoding:US-ASCII>
r =~ "\u{6666}...
...a".force_encoding("euc-jp") # => 2
r =~ "abc".force_encoding("euc-jp") # => 0

r = /a/u
r.fixed_encoding? # => true
r.encoding # => #<Encoding:UTF-8>
r =~ "\u{6666} a" # => 2
begin
r =...
...~ "\xa1\xa2".force_encoding("euc-jp")
rescue => e
e.class # => Encoding::CompatibilityError
end
r =~ "abc".force_encoding("euc-jp") # => 0

r = /\u{6666}/
r.fixed_encoding? # => true
r.encoding...

正規表現 (132.0)

正規表現 * metachar * expansion * char * anychar * string * str * quantifier * capture * grouping * subexp * selector * anchor * cond * option * encoding * comment * free_format_mode * absenceop * list * specialvar * references

...achar
* expansion
* char
* anychar
* string
* str
* quantifier
* capture
* grouping
* subexp
* selector
* anchor
* cond
* option
* encoding
* comment
* free_format_mode
* absenceop
* list
* specialvar
* references


正規表現(regular expression)は文字列...
...ing # => #<Encoding:UTF-8>
//}

正規表現のエンコーディングと文字列のエンコーディングが非互換で
ある場合、Encoding::CompatibilityError が発生します。

エンコーディングについては spec/m17n も参考にしてください。

Regexp#fixed_encoding?...
...CII互換な文字列であればマッチの判定をさせる
ことができます。Regexp.new に Regexp::FIXEDENCODING を
指定することで明示的に指定することが可能です。

//emlist[][ruby]{
# -*- coding:utf-8 -*-
/あいう/.fixed_encoding? # => true
/abc/.fixed_encoding?...