RE: semantics of substring()

"Ashok Malhotra" <[email protected]>
Newsgroups gmane.comp.web.query-languages
Message-ID <EDB607C8AC991F40BE646533A1A673E80183194F@RED-MSG-42.redmond.corp.microsoft.com>
Howard:
I believe your interpretation is correct.

In future please send comments on XML Query and XPath 2.0 to 
[email protected].

All the best, Ashok

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of
Howard Katz
Sent: Friday, March 12, 2004 8:17 AM
To: Marcus Boerger
Cc: [email protected]
Subject: RE: semantics of substring()


I'm presuming by Michael's prior example that substring( "12345", -1, 3)
is
thus to be interpreted as the 3 characters starting from the -1'th
position
in the string. Which gives "1".

Grappling with the concept of imaginary numbers in university helped
convince me that I didn't have a vocation in the hard sciences.
Hopefully
the rather novel concept of imaginary character positions in strings
won't
similarly drive me out of computing! :-)

Howard

> -----Original Message-----
> From: Marcus Boerger [mailto:[email protected]]
> Sent: Friday, March 12, 2004 1:48 AM
> To: Howard Katz
> Cc: [email protected]
> Subject: Re: semantics of substring()
>
>
> Hello Howard,
>
> Friday, March 12, 2004, 2:28:09 AM, you wrote:
>
>
> > I don't understand one of the examples given for fn:substring()
> in the F and
> > O documentation [7.4.3]. The description of the function's
> behaviour says,
> > "If $startingLoc is zero or negative, the substring includes
> characters from
> > the beginning of the $sourceString." I take this to mean that
>
> >     substring( "12345", 0, 3 )
>
> > is equivalent to
>
> >     substring( "12345", 1, 3 )
>
> > which I understand evaluates to "123".
>
> > The example shown in the documentation however returns "12", and
Saxon
> > echoes this. What am I misunderstanding?
>
> Wouldn't startlogic mean
>     substring("12345", -1, 3) = "123" or "12"
> the problem i have here is how to compute the length. starting with
the
> nonexisting char at -1 or with the first existing one?
>
> --
> Best regards,
>  Marcus                            mailto:[email protected]
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.