[#2023] Class Method の index — (Dezawa Shin-ichiro) <dezawa@...>

出沢です

13 messages 1997/02/02

[#2158] [Req] pack/unpack — keiju@... (Keiju ISHITSUKA)

けいじゅ@SHLジャパンです.

14 messages 1997/02/18
[#2166] Re: [Req] pack/unpack — matz@... (Yukihiro Matsumoto) 1997/02/18

まつもと ゆきひろです.

[#2277] ruby 1.0-970228 available — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです.

16 messages 1997/02/28

[ruby-list:2171] Re: [BUG] split(" ", limit)

From: WATANABE Hirofumi <watanabe@...>
Date: 1997-02-18 10:42:09 UTC
List: ruby-list #2171
わたなべです.

:原です。
:
:久しぶりに split でバグをみつけました。
:
:print "a b c".split(" ", 3).join(","), "\n" # => a,b,b c

これでどうかな? の 2 回目.

-- 
わたなべひろふみ

--- ../ruby-1.0-970217/string.c	Fri Feb  7 15:16:05 1997
+++ string.c	Tue Feb 18 19:37:29 1997
@@ -1629,7 +1629,7 @@
     rb_scan_args(argc, argv, "02", &spat, &limit);
     if (!NIL_P(limit)) {
 	lim = NUM2INT(limit);
-	i = 1;
+	i = 0;
     }
 
     if (NIL_P(spat)) {
@@ -1679,8 +1679,8 @@
 		}
 		else {
 		    if (isspace(*ptr)) {
-			ary_push(result, str_substr(str, beg, end-beg));
 			if (!NIL_P(limit) && lim <= ++i) break;
+			ary_push(result, str_substr(str, beg, end-beg));
 			skip = 1;
 			beg = end + 1;
 		    }
@@ -1693,8 +1693,8 @@
 	else {
 	    for (end = beg = 0; ptr<eptr; ptr++) {
 		if (*ptr == char_sep) {
-		    ary_push(result, str_substr(str, beg, end-beg));
 		    if (!NIL_P(limit) && lim <= ++i) break;
+		    ary_push(result, str_substr(str, beg, end-beg));
 		    beg = end + 1;
 		}
 		end++;

In This Thread