[macruby-changes] [3670] MacRuby/branches/icu/string.c

source_changes at macosforge.org source_changes at macosforge.org
Tue Mar 2 17:33:13 PST 2010


Revision: 3670
          http://trac.macosforge.org/projects/ruby/changeset/3670
Author:   lsansonetti at apple.com
Date:     2010-03-02 17:33:12 -0800 (Tue, 02 Mar 2010)
Log Message:
-----------
forgot rdoc

Modified Paths:
--------------
    MacRuby/branches/icu/string.c

Modified: MacRuby/branches/icu/string.c
===================================================================
--- MacRuby/branches/icu/string.c	2010-03-03 01:31:59 UTC (rev 3669)
+++ MacRuby/branches/icu/string.c	2010-03-03 01:33:12 UTC (rev 3670)
@@ -3599,6 +3599,31 @@
     return str;
 }
 
+/*
+ *  call-seq:
+ *     str.succ   => new_str
+ *     str.next   => new_str
+ *  
+ *  Returns the successor to <i>str</i>. The successor is calculated by
+ *  incrementing characters starting from the rightmost alphanumeric (or
+ *  the rightmost character if there are no alphanumerics) in the
+ *  string. Incrementing a digit always results in another digit, and
+ *  incrementing a letter results in another letter of the same case.
+ *  Incrementing nonalphanumerics uses the underlying character set's
+ *  collating sequence.
+ *     
+ *  If the increment generates a ``carry,'' the character to the left of
+ *  it is incremented. This process repeats until there is no carry,
+ *  adding an additional character if necessary.
+ *     
+ *     "abcd".succ        #=> "abce"
+ *     "THX1138".succ     #=> "THX1139"
+ *     "<<koala>>".succ   #=> "<<koalb>>"
+ *     "1999zzz".succ     #=> "2000aaa"
+ *     "ZZZ9999".succ     #=> "AAAA0000"
+ *     "***".succ         #=> "**+"
+ */
+
 static VALUE
 rstr_succ(VALUE str, SEL sel)
 {
@@ -3671,6 +3696,15 @@
     return newstr;
 }
 
+/*
+ *  call-seq:
+ *     str.succ!   => str
+ *     str.next!   => str
+ *  
+ *  Equivalent to <code>String#succ</code>, but modifies the receiver in
+ *  place.
+ */
+
 static VALUE
 rstr_succ_bang(VALUE str, SEL sel)
 {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100302/121784ba/attachment.html>


More information about the macruby-changes mailing list