Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

XSLT - String ending with a numeric

Posted on 2011-09-13
5
Medium Priority
?
295 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 2000 total points
ID: 36532645
me too, but for that you need an XSLT2 processor
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

916 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