日期:2014-05-17  浏览次数:20835 次

如何获取指定字符后指定字符前的字符串?
现在有这样的信息:
/uploadfile/document\Mobile   Storage   Drive中文说明BTC-6117.doc#application/msword#225280
/uploadfile/word\NPS价格体系(1)-9561.doc#application/msword#36352
/uploadfile/other\NPS网上支付解决方案-8638.doc#application/msword#336896
我如何能获得这些文件名,就是Mobile   Storage   Drive中文说明BTC-6117.doc和NPS价格体系(1)-9561.doc以及NPS网上支付解决方案-8638.doc?
现在已有处理程序能将这样的信息分别取出文件路径和文件类型以及文件大小插入到数据表中,现在需要增加一项就是能把文件名也取出来插入到表中,代码如下:

Dim   Sql,Rs,S,shuzu,tempfile,testfile,filetitle,fileurl,filetype,filesize
S=request.form( "Filedescript1 ")
        shuzu=split(S,vbcrlf)
        for   i=0   to   ubound(shuzu)-1
        tempfile=shuzu(i)
testfile=split(tempfile, "# ")
        fileurl=testfile(0)
        filetype=Replace(testfile(1), "application/ ", " ")  
        filesize=testfile(2)
Sql= "Select   Top   1   *   From   FileInfo   Order   By   ID   DESC "
        Set   Rs=Server.CreateObject( "ADODB.RecordSet ")
        Rs.Open   Sql,Conn,1,3
        Rs.AddNew

Rs( "Title ")=?就是这里该如何获得?
                    Rs( "FileUrl ")=fileurl
Rs( "FileType ")=filetype
Rs( "FileSize ")=filesize

Rs.Update
Rs.Close:Set   Rs=Nothing
        next

------解决方案--------------------
left(mid(str, instr(str, "\ ") + 1), instr(mid(str, instr(str, "\ ") + 1), ". ") - 1)

把mid(str, instr(str, "\ ") 提出来先付给变量代入也可以.