Solved

XSLT - String ending with a numeric

Posted on 2011-09-13
5
242 Views
Last Modified: 2012-06-21
How do i test if a String ends with a numeric ?
0
Comment
Question by:Molko
  • 4
5 Comments
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 36532206
given the string is $str

<xsl:if test="translate(substring($str, string-length($str)), '0123456789', '') = '' " >
...
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 36532214
substring takes the last character
the translate maps any digit to nothing
if the last character is a digit, this translate returns a ''
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 36532223
in XSLT2

<xsl:if test="matches($str, '\d$')" >
...
0
 

Author Comment

by:Molko
ID: 36532421
Hi

yeah, think i prefer the regex
0
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 36532645
me too, but for that you need an XSLT2 processor
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to dynamically set the form action using jQuery.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now