instance method
String#unicode_normalized?
(?:nfc | :nfd | :nfkc | :nfkd) -> bool
unicode_normalized?(form = :nfc) → true or false
string.c
View on GitHub ↗
static VALUE
rb_str_unicode_normalized_p(int argc, VALUE *argv, VALUE str)
{
return unicode_normalize_common(argc, argv, str, id_normalized_p);
}
Returns whether self is in the given form of Unicode normalization; see String#unicode_normalize.
The form must be one of :nfc, :nfd, :nfkc, or :nfkd.
Examples:
Example
"a\u0300".unicode_normalized? # => false "a\u0300".unicode_normalized?(:nfd) # => true "\u00E0".unicode_normalized? # => true "\u00E0".unicode_normalized?(:nfd) # => false
Raises an exception if self is not in a Unicode encoding:
Example
s = "\xE0".force_encoding(Encoding::ISO_8859_1) s.unicode_normalized? # Raises Encoding::CompatibilityError
Related: see Querying.
See also
#unicode_normalize!
#unpack
#unicode_normalize
#unpack1
also in
4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0