[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Counting occurences of a character in a string

Subject: Re: Counting occurences of a character in a string
From: Geert Bormans <geert@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 02 Apr 2008 00:11:38 +0200
Re:  Counting occurences of a character in a string
The XSLT1 way?
string-length($s) - string-length(translate($s, 'X', ''))

At 00:01 2/04/2008, you 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]+" ), "" ) )

?

I'm sure there must be, I just don't see it at the moment...

-Christian

Current Thread

Back To School Sale!

Save 30% off all Stylus Studio 2008 Products when you purchase from our Online Shop.

Offer ends August 31, 2008.

Coupon Code
TRTY-C4JV-OFF

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.