bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Why the length(seps) is one more than the return value of


From: arnold
Subject: Re: [bug-gawk] Why the length(seps) is one more than the return value of patsplit()?
Date: Sun, 08 Mar 2015 06:36:06 -0600
User-agent: Heirloom mailx 12.4 7/29/08

Peng Yu <address@hidden> wrote:

> Hi,
>
> The following code shows that the length(seps) is one more than the
> return value of patsplit(). I thought that seps should have the same
> as the number of elements in "a". Why it is not the case? Could
> anybody help me understand this? Thanks.
>
> ~$ awk 'BEGIN { print patsplit("aAbBcC", a, /[a-z]/, seps); print
> seps[1], seps[2], seps[3], length(seps); }'
> 3
> A B C 4
>
> -- 
> Regards,
> Peng

Hi. Thanks for the report.  The fourth element is the null string. This
may be a bug. I need to review the code and work with it a bit.  I'll
reply again when I have more information.

THanks,

Arnold



reply via email to

[Prev in Thread] Current Thread [Next in Thread]