I just browsed several records and seemed to me that
quite a few people (and including me) like to see that
“split” based on argument type. If it is a string, then
use string as the separator. For Regexp, use the Regexp.
This is basically the Ruby way to overload “split” method.
Was there a final decision on this? A lot of codes could break
due to this change.
Thanks
-Ted
···
From POP3 Thu Aug 22 12:37:00 EDT 2002
Date: Fri, 23 Aug 2002 00:32:26 +0900
Posted: 22 Aug 2002 09:41:13 -0600
From: Tom Sawyer transami@transami.net
Subject: Re: split warning
To: ruby-talk@ruby-lang.org (ruby-talk ML)
X-ML-Name: ruby-talk
X-Mail-Count: 47898
X-MLServer: fml [fml 3.0pl#17]; post only (anyone can post)
X-ML-Info: If you have a question, send e-mail with the body
“help” (without quotes) to the address ruby-talk-ctl@ruby-lang.org;
help=mailto:ruby-talk-ctl@ruby-lang.org?body=help
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
i believe the final decision was to change it per the overall opinions.
prior to this only a single character string was actually treated as a
string, all others were converted to regexp. now it will be as you have
pointed out: strings will be string and regexps regexps
so:
“abc”.split(“\r\n”) # as string
“abc”.split(/\r\n/) # as regexp
the warning that you saw was put in to let people know about this
change. yes, some older code will have to be touched up.
~transami
p.s. please correct if i misrepresented any of this.
I just browsed several records and seemed to me that
quite a few people (and including me) like to see that
“split” based on argument type. If it is a string, then
use string as the separator. For Regexp, use the Regexp.
This is basically the Ruby way to overload “split” method.
Was there a final decision on this? A lot of codes could break
due to this change.
Thanks
-Ted
From POP3 Thu Aug 22 12:37:00 EDT 2002
Date: Fri, 23 Aug 2002 00:32:26 +0900
Posted: 22 Aug 2002 09:41:13 -0600
From: Tom Sawyer transami@transami.net
Subject: Re: split warning
To: ruby-talk@ruby-lang.org (ruby-talk ML)
X-ML-Name: ruby-talk
X-Mail-Count: 47898
X-MLServer: fml [fml 3.0pl#17]; post only (anyone can post)
X-ML-Info: If you have a question, send e-mail with the body
“help” (without quotes) to the address ruby-talk-ctl@ruby-lang.org;
help=mailto:ruby-talk-ctl@ruby-lang.org?body=help
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
I’ve read the thread and matz’ last word on this is that split will work
the way you describe it, ie strings longer than 1 char will not be
converted to Regexp anymore.
I just browsed several records and seemed to me that
quite a few people (and including me) like to see that
“split” based on argument type. If it is a string, then
use string as the separator. For Regexp, use the Regexp.
This is basically the Ruby way to overload “split” method.
Was there a final decision on this? A lot of codes could break
due to this change.