Re: substring: explanation of negative or zero $startingLoc behaviour

For what it's worth, I'm used to language (e.g. Perl) in which
negative character positions are taken as being from the end of
the string, and where substring(-5, 4, "xxx.html") returns ".htm".

This avoids having to use string-length and a subtraction, but is
possibly no clearer than having negative offsets be treated as
falling off the left hand edge of the string into virtual nul
characters that don't get included in the result. :-X

Actually no, it *is* clearer.

Liam

-- 
Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin/
http://www.holoweb.net/~liam/

Received on Friday, 12 March 2004 18:41:40 UTC