Re: [exim] Bug in 4.34: ${substr with empty second argument …

Pàgina inicial
Delete this message
Reply to this message
Autor: Andreas Metzler
Data:  
A: exim-users
Assumpte: Re: [exim] Bug in 4.34: ${substr with empty second argument not working.
On Wed, Aug 25, 2004 at 05:08:00PM +0200, Andreas Metzler wrote:
> I just found that ${substr is slightly broken in 4.34, this does not
> work:
> | If the second number is omitted from substr, the remainder of the
> | string is taken if the offset was positive. If it was negative, all
> | characters in the string preceding the offset point are taken. For
> | example, an offset of -1 and no length yields all but the last
> | character of the string.
>
> It is easy to test:
> /usr/sbin/exim -be '${substr_1_:12345}'
> should yield "2345" according to the docs, but it does yield an empty
> string instead. ('${substr{-1}{}{12345}}' does not work either.)

[...]

Thanks to Adam D. Barratt for enlightening me:
${substr_1:12345} and ${substr{1}{12345}} work as I had hoped.

Could the documentation be made a little bit more verbose by including
a copy-and-paste-example?

-For example, an offset of -1 and no length yields all but the last character of the string.
+For example, ${substr{-1}{string}} or ${substr_-1:string} respectively yields all but the last character of the string.

          thanks, cu andreas