W3C home > Mailing lists > Public > public-qt-comments@w3.org > February 2004

[F&O] CER-08 position-of

From: Mary Holstege <mary@cerisent.com>
Date: Sun, 15 Feb 2004 11:30:54 -0800
Message-ID: <16431.51438.934000.347459@gargle.gargle.HOWL>
To: public-qt-comments@w3.org


F&O 7.4.3

fn:substring takes positional parameters to figure out which substring to
select, but no functions are provided to determine the position of any
interesting piece of a string. Request the addition of such functions.

Options:
(a) One function that returns positions of all matches, similar to fn:index-of
    for sequence:

    fn:position-of( $source as xs:string, $pattern as xs:string ) as xs:integer*

    Example:
       let $suffix := substring( $url, position-of( $url, "/")[last()] )
       return substring( $suffix, position-of( $suffix, "#" )[1] )

(b) One function that gives first matching position, and one that gives
    the last matching position, similar to similar functions in various
    programming languages:

    fn:position-of( $source as xs:string, $pattern as xs:string ) as xs:integer
    fn:last-position-of( $source as xs:string, $pattern as xs:string ) as xs:integer

    Example: 
       let $suffix := substring( $url, last-position-of( $url, "/" ) )
       return substring( $suffix, position-of( $suffix, "#" ) )
Received on Tuesday, 17 February 2004 11:10:10 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:13:57 UTC