mirror of
https://github.com/ruby/ruby.git
synced 2026-10-28 16:36:20 +08:00
[DOC] Tweaks for String#unicode_normalize
This commit is contained in:
1 parent
319001192d
commit
1443f89d69
2 files changed
+29
-27
Notes:
git
2025-11-19 02:57:59 +00:00
No files matched your search
@@ -0,0 +1,28 @@
|
||||
Returns a copy of +self+ with
|
||||
{Unicode normalization}[https://unicode.org/reports/tr15] applied.
|
||||
|
||||
Argument +form+ must be one of the following symbols
|
||||
(see {Unicode normalization forms}[https://unicode.org/reports/tr15/#Norm_Forms]):
|
||||
|
||||
- +:nfc+: Canonical decomposition, followed by canonical composition.
|
||||
- +:nfd+: Canonical decomposition.
|
||||
- +:nfkc+: Compatibility decomposition, followed by canonical composition.
|
||||
- +:nfkd+: Compatibility decomposition.
|
||||
|
||||
The encoding of +self+ must be one of:
|
||||
|
||||
- <tt>Encoding::UTF_8</tt>.
|
||||
- <tt>Encoding::UTF_16BE</tt>.
|
||||
- <tt>Encoding::UTF_16LE</tt>.
|
||||
- <tt>Encoding::UTF_32BE</tt>.
|
||||
- <tt>Encoding::UTF_32LE</tt>.
|
||||
- <tt>Encoding::GB18030</tt>.
|
||||
- <tt>Encoding::UCS_2BE</tt>.
|
||||
- <tt>Encoding::UCS_4BE</tt>.
|
||||
|
||||
Examples:
|
||||
|
||||
"a\u0300".unicode_normalize # => "à" # Lowercase 'a' with grave accens.
|
||||
"a\u0300".unicode_normalize(:nfd) # => "à" # Same.
|
||||
|
||||
Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].
|
||||
@@ -11926,34 +11926,8 @@ unicode_normalize_common(int argc, VALUE *argv, VALUE str, ID id)
|
||||
* call-seq:
|
||||
* unicode_normalize(form = :nfc) -> string
|
||||
*
|
||||
* Returns a copy of +self+ with
|
||||
* {Unicode normalization}[https://unicode.org/reports/tr15] applied.
|
||||
* :include: doc/string/unicode_normalize.rdoc
|
||||
*
|
||||
* Argument +form+ must be one of the following symbols
|
||||
* (see {Unicode normalization forms}[https://unicode.org/reports/tr15/#Norm_Forms]):
|
||||
*
|
||||
* - +:nfc+: Canonical decomposition, followed by canonical composition.
|
||||
* - +:nfd+: Canonical decomposition.
|
||||
* - +:nfkc+: Compatibility decomposition, followed by canonical composition.
|
||||
* - +:nfkd+: Compatibility decomposition.
|
||||
*
|
||||
* The encoding of +self+ must be one of:
|
||||
*
|
||||
* - Encoding::UTF_8
|
||||
* - Encoding::UTF_16BE
|
||||
* - Encoding::UTF_16LE
|
||||
* - Encoding::UTF_32BE
|
||||
* - Encoding::UTF_32LE
|
||||
* - Encoding::GB18030
|
||||
* - Encoding::UCS_2BE
|
||||
* - Encoding::UCS_4BE
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* "a\u0300".unicode_normalize # => "a"
|
||||
* "\u00E0".unicode_normalize(:nfd) # => "a "
|
||||
*
|
||||
* Related: String#unicode_normalize!, String#unicode_normalized?.
|
||||
*/
|
||||
static VALUE
|
||||
rb_str_unicode_normalize(int argc, VALUE *argv, VALUE str)
|
||||
|
||||
Reference in new issue
Block a user