[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Re: .substring bug - indicies don't work as documented(?)
From: |
Werner LEMBERG |
Subject: |
Re: [Groff] Re: .substring bug - indicies don't work as documented(?) |
Date: |
Sun, 28 Oct 2001 02:58:53 +0100 (CET) |
> > for s=abcdefg .substring s 0 yields "g"
> > for s=abcdefg .substring s 1 yields "abcdefg"
> > for s=abcdefg .substring s 2 yields "bcdefg"
> >
> BTW how about defining a single argument meaning the corresponding
> character, e.g. ".substring s 1" the first letter and ".substring
> -1" the last letter.
I prefer the current syntax, i.e., no second argument (i.e., set to
zero) means `take the rest'. This is probably the very reason to make
the last character have the index 0.
> It is illogical to start with 1 from the front and with 0 from the
> end. Moreover, 0 means everything up to behind the last character;
> so the last character should be -1 anyway.
I agree, but I think it isn't worth the trouble.
> Also 2 args in reversed order could be made into reversing the
> output.
Who needs that?
Werner