Click to See Complete Forum and Search --> : XSL Sting Manipulation, splitting strings


mattisimo
02-10-2004, 04:41 AM
Hi,
I am trying to find the file extension from a string.
e.g. "test.doc" or "test.html" but the string is going to have several . in it as it will be from a URL. Is there a simple/clean way of separating the sting and extracting the file extension?
I was thinking of splitting the string by instance of . and then selecting the last section.
Any ideas on this?
Thanks for the help,
Matt

Macroman
02-11-2004, 02:03 PM
If you know VB Script then you can use this

txtString = "filename.doc"
txtExtension = Right(txtString, Len(txtString) - InStr(1, txtString, "."))
response.write (txtExtension)

Works ok in Excel macro.

regards

macroman

mattisimo
02-23-2004, 03:59 AM
Thanks Macroman,
I found that you can include VBScript into XSL so I used script like yours.
Matt