Re: patch to change behavior of g_strsplit on empty string back to 1.2 behavior
- From: Owen Taylor <otaylor redhat com>
- To: Darin Adler <darin bentspoon com>
- Cc: gtk-devel-list gnome org
- Subject: Re: patch to change behavior of g_strsplit on empty string back to 1.2 behavior
- Date: 18 Jul 2001 17:33:03 -0400
Darin Adler <darin bentspoon com> writes:
> On Wednesday, July 18, 2001, at 02:12 PM, Owen Taylor wrote:
>
> > The code in GLib stable didn't do that either, however, what it
> > produced was
> >
> > "w,x,y,z", ",", 2 => "w" "x" "y,z"
>
> After re-reading it, I think this matches what the docs say.
The docs are not clear on the matter. And of course, they were written
after the code.
On the other hand:
- I don't think it really makes sense to produce more than max_tokens
elements in the array.
- g_strsplit() was based on perl's split function, and we have:
$ perl -e 'print join ("|", split /:/, "a:b:c:d", 2), "\n"'
a|b:c:d
I actually know of no decent reason to use max_tokens, and would
guess that the vast majority of all cases use 0 or -1, so it may
be fairly academic.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]