Oxygen XML Editor
 
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Counting occurences of a character in a string


Subject: Re: [xsl] Counting occurences of a character in a string
From: "Manfred Staudinger" <manfred.staudinger@xxxxxxxxx>
Date: Wed, 2 Apr 2008 00:10:28 +0200

On 02/04/2008, Christian Roth <roth@xxxxxxxxxxxxxx> wrote:
> Hello,
>
>  in XSLT 2, is there an easier or more efficient way to count the
>  occurrences of a certain character (here: 'X') in a string $s than
>
>  string-length( string-join( tokenize( $s, "[^X]+" ), "" ) )
>
string-length($s) - string-length(translate($s, 'X', ''))

Manfred


Current Thread
 
© 2002-2008 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy
This website was created & generated with <oXygen/> XML Editor
Keywords