Strip extension function

J

John Aspinall

Hi,

Is there a string function to strip the file extension from a variable
in ASP? If not any suggestions as to the best way to approach this?

Cheers...John
 
E

Evertjan.

John Aspinall wrote on 17 nov 2004 in
microsoft.public.inetserver.asp.general:
Is there a string function to strip the file extension from a variable
in ASP? If not any suggestions as to the best way to approach this?

ASP is not a language, but a platform for script languages.

ASP vbscript:

function stripExt(x)
n = InStrRev(s,".")
if n>0 then
stripExt = left(s,n-1)
else
stripExt = x
end if
end function


ASP jscript:

function stripExt(x){
return x.replace(/\.[^\.]*$/,'')
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,901
Members
47,439
Latest member
elif2sghost

Latest Threads

Top