<%
'实例1与实例2效果一样,方法不同
'截取实例1
function sub_str(byval str, byval pstr) ' str 为要截取的字符串,pstr 限定的字符
pos = instr(str, pstr)
if pos > 0 then str = left(str, pos + len(pstr) - 1)
sub_str = str
end function
str = "upfile/Smallpic/201141314212195588.jpgsdf%20sdfsdf"
'截取.jpg并包含.jpg字符串之前的所有字符串
response.Write sub_str(str,".jpg")
response.Write "<br>"
'截取实例2
'截取字符“.”并包含“.”后面3位之前的所有字符串
k="upfile/Smallpic/201141314212195.jpgss%fsdfsf0%s"
response.Write left(k,InstrRev(k,".")+3)
response.Write "<br>"
%>