"No.9".succ == "Np.0"

e$B$k$S$-$A$G$9!#e(B

e$B8=>u$Ne(BString#succe$B$O0J2<$N$h$&$J5sF0$K$J$k$N$G$9$,!"e(B
e$BHs1Q?t;[email protected]?t;z$H1Q;z$N7+$j>e$,$j$OJL$K$7$?$[$&$,$$$$$N$G$O$J$$$G$7$g$&$+!)e(B
e$B$D$^$j!Ve(B"No.10"e$B!W$rJV$9$[$&$,<[email protected]$H;W$$$^$9!#e(B

“No.9”.succ # => “Np.0”
“1z”.succ # => “2a”

e$B8e<T$O;[email protected]$k$H;W$$$^$9$,!"A0<T$h$&$KHs1Q?t;z$r$O$5$s$G7+$j>e$,$k$N$Oe(B
e$B$$$S$D$J46$8$,$7$^$9!#e(B

e$B<2C+$G$9!#e(B

-------- Original Message --------
Subject: [ruby-dev:35094] “No.9”.succ == “Np.0”
From: [email protected]
To: ruby developers list [email protected]
Date: Sat Jun 14 2008 03:00:18 GMT+0900

e$B$$$S$D$J46$8$,$7$^$9!#e(B
“a9”.succ e$B$,e(B “b1” e$B$K$J$C$FM_$7$$?M$b$$$=$&$G$9e(B

[email protected]$G$9!#e(B

At Sat, 14 Jun 2008 03:00:18 +0900,
[email protected] wrote in [ruby-dev:35094]:

e$B8=>u$Ne(BString#succe$B$O0J2<$N$h$&$J5sF0$K$J$k$N$G$9$,!"e(B
e$BHs1Q?t;[email protected]?t;z$H1Q;z$N7+$j>e$,$j$OJL$K$7$?$[$&$,$$$$$N$G$O$J$$$G$7$g$&$+!)e(B
e$B$D$^$j!Ve(B"No.10"e$B!W$rJV$9$[$&$,<[email protected]$H;W$$$^$9!#e(B

e$B$H$/$K:$$k$3$H$b$J$$$+$bCN$l$^$;$s$M!#e(B

Index: stable/string.c

— stable/string.c (revision 17940)
+++ stable/string.c (working copy)
@@ -1417,4 +1417,8 @@ rb_str_succ(orig)
n = s - sbeg;
}

  • else if (c != -1) {
  •  n = ++s - sbeg;
    
  •  break;
    
  • }
    s–;
    }
    @@ -1426,6 +1430,7 @@ rb_str_succ(orig)
    s–;
    }
  • c = 0;
    }
  • if (s < sbeg) {
  • if (s < sbeg || c > 0) {
    RESIZE_CAPA(str, RSTRING(str)->len + 1);
    s = RSTRING(str)->ptr + n;
    Index: trunk/string.c
    ===================================================================
    — trunk/string.c (revision 17940)
    +++ trunk/string.c (working copy)
    @@ -2537,10 +2537,11 @@ rb_str_succ(VALUE orig)
    neighbor = enc_succ_alnum_char(s, l, enc, carry);
    if (neighbor == NEIGHBOR_NOT_CHAR)
  •        continue;
    
  •    if (neighbor == NEIGHBOR_FOUND)
    
  •        s++;
    
  •    else if (neighbor == NEIGHBOR_FOUND)
           return str;
       c = 1;
       carry_pos = s - sbeg;
       carry_len = l;
    
  •    if (neighbor == NEIGHBOR_NOT_CHAR) break;
    
    }
    if (c == -1) { /* str contains no alnum */

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message "Re: [ruby-dev:35385] Re: “No.9”.succ == “Np.0"”
on Mon, 7 Jul 2008 17:41:35 +0900, Nobuyoshi N.
[email protected] writes:

|At Sat, 14 Jun 2008 03:00:18 +0900,
|[email protected] wrote in [ruby-dev:35094]:
|> e$B8=>u$Ne(BString#succe$B$O0J2<$N$h$&$J5sF0$K$J$k$N$G$9$,!"e(B
|> e$BHs1Q?t;[email protected]?t;z$H1Q;z$N7+$j>e$,$j$OJL$K$7$?$[$&$,$$$$$N$G$O$J$$$G$7$g$&$+!)e(B
|> e$B$D$^$j!Ve(B"No.10"e$B!W$rJV$9$[$&$,<[email protected]$H;W$$$^$9!#e(B
|
|e$B$H$/$K:$$k$3$H$b$J$$$+$bCN$l$^$;$s$M!#e(B

e$BA0$+$i5$$K$J$C$F$$$?$N$G!"<h$j9~$b$&$H;W$$$^$9!#%3%_%C%H$7$Fe(B
e$B$/[email protected]$5$$!#e(B