From 057dcc0495e9f6e85c322bf294dd03dde3899de7 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 27 Jun 2003 05:41:28 +0000 Subject: [PATCH] * string.c (rb_str_split_m): remove white spaces on the head of the last element, when limit is specified. [ruby-talk:74506] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ string.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3ed7884d46..b5479975ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Jun 27 14:41:22 2003 Nobuyoshi Nakada + + * string.c (rb_str_split_m): remove white spaces on the head of + the last element, when limit is specified. [ruby-talk:74506] + Fri Jun 27 03:24:54 2003 Nobuyoshi Nakada * io.c (io_fflush): need to check if closed after thread switch. diff --git a/string.c b/string.c index 52c3a70b5b..885b3e608e 100644 --- a/string.c +++ b/string.c @@ -2581,6 +2581,7 @@ rb_str_split_m(argc, argv, str) else { end = beg+1; skip = 0; + if (!NIL_P(limit) && lim <= i) break; } } else { @@ -2588,7 +2589,7 @@ rb_str_split_m(argc, argv, str) rb_ary_push(result, rb_str_substr(str, beg, end-beg)); skip = 1; beg = end + 1; - if (!NIL_P(limit) && lim <= ++i) break; + if (!NIL_P(limit)) ++i; } else { end++;