[前][次][番号順一覧][スレッド一覧]

ruby-changes:43141

From: duerst <ko1@a...>
Date: Mon, 30 May 2016 20:00:30 +0900 (JST)
Subject: [ruby-changes:43141] duerst:r55215 (trunk): * string.c: Document current situation for String#downcase. [ci skip]

duerst	2016-05-30 20:00:26 +0900 (Mon, 30 May 2016)

  New Revision: 55215

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55215

  Log:
    * string.c: Document current situation for String#downcase. [ci skip]

  Modified files:
    trunk/ChangeLog
    trunk/string.c
Index: string.c
===================================================================
--- string.c	(revision 55214)
+++ string.c	(revision 55215)
@@ -5983,12 +5983,45 @@ rb_str_downcase_bang(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/string.c#L5983
 
 /*
  *  call-seq:
- *     str.downcase   -> new_str
+ *     str.downcase              -> new_str
+ *     str.downcase([options])   -> new_str
  *
  *  Returns a copy of <i>str</i> with all uppercase letters replaced with their
- *  lowercase counterparts. The operation is locale insensitive---only
- *  characters ``A'' to ``Z'' are affected.
- *  Note: case replacement is effective only in ASCII region.
+ *  lowercase counterparts. Which letters exactly are replaced, and by which
+ *  other letters, depends on the presence or absence of options, and on the
+ *  +encoding+ of the string.
+ *
+ *  The meaning of the +options+ is as follows:
+ *
+ *  No option ::
+ *    Currently, old behavior (only the ASCII region, i.e. characters
+ *    ``A'' to ``Z'', and/or ``a'' to ``z'', are affected).
+ *    This will change very soon to full Unicode case mapping.
+ *  :ascii ::
+ *    Only the ASCII region, i.e. the characters ``A'' to ``Z'', are affected.
+ *    This option cannot be combined with any other option.
+ *  :turkic ::
+ *    Full Unicode case mapping, adapted for Turkic languages
+ *    (Turkish, Aserbaijani,...). This means that upper case I is mapped to
+ *    lower case dotless i, and so on.
+ *  :lithuanian ::
+ *    Currently, just full Unicode case mapping. In the future, full Unicode
+ *    case mapping adapted for Lithuanian (keeping the dot on the lower case
+ *    i even if there's an accent on top).
+ *  :fold ::
+ *    Only available on +downcase+ and +downcase!+. Unicode case folding, which
+ *    is more far-reaching than Unicode case mapping. This option currently
+ *    cannot be combined with any other option (i.e. we do not currenty
+ *    implement a variant for turkic languages).
+ *
+ *  Please note that several assumptions that are valid for ASCII-only case
+ *  conversions do not hold for more general case conversions. For example,
+ *  the length of the result may not be the same as the length of the input
+ *  (neither in characters nor in bytes), and some roundtrip assumptions
+ *  (e.g. str.downcase == str.downcase.upcase.downcase) may not apply.
+ *
+ *  Non-ASCII case mapping/folding is currently only supported for UTF-8 Strings,
+ *  but this support will be extended to other encodings in the future.
  *
  *     "hEllO".downcase   #=> "hello"
  */
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55214)
+++ ChangeLog	(revision 55215)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon May 30 20:00:25 2016  Martin Duerst  <duerst@i...>
+
+	* string.c: Document current situation for String#downcase. [ci skip]
+
 Mon May 30 18:29:28 2016  Kazuki Yamaguchi  <k@r...>
 
 	* ext/openssl/ossl_ssl.c (ossl_sslctx_s_alloc): Enable the automatic

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]