microkarl Posted September 6, 2005 Posted September 6, 2005 All, I have a problem when writing code on XSLT. I have a string like this: "123454433-56545663". I need to find a way to extract the last 3 digits before the "-" so the result will become: "433", I though about Substring but then I realized I cannot do it because the parameters of Substring is: "string, number, number", and I need to distinguish the "-". Does anyone have any idea? Many thanks, Carl Quote Donald DUCK : YOU ARE FIRED!!!
sgt_pinky Posted September 6, 2005 Posted September 6, 2005 You can use .IndexOf() to find the location of the hyphen, then use .Substring(). Quote
sgt_pinky Posted September 6, 2005 Posted September 6, 2005 Oops, sorry. I clearly didn't read the XSLT part.... Quote
sgt_pinky Posted September 6, 2005 Posted September 6, 2005 You can use fn:substring-before(string1,string2) Returns the start of string1 before string2 occurs in it Example: substring-before('12/10','/') Result: '12' Then use substring. XSLT string functions Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.