MusicGet 类

2019-01-14 04:34:27刘景俊

    '*****************************************************************
    '    function(公有)
    '    作用 :格式化远程音乐文件地址为本地位置
    '    参数 :MusicUrl(远程文件地址),oServerUrl (原服务连接地址),MusicFolder(本地音乐文件目录)
    '*****************************************************************
    Public Function FormatMusicPath(byref MusicUrl,byref oServerUrl,byref MusicFolder)
        strpath=""
        strpath = Replace(MusicUrl,oServerUrl,"")
        strpath = MusicFolder&"/"&strpath
        strpath = Replace(strpath,"//","/")
        if left(strpath,1)="/" then strpath=right(strpath,len(strpath)-1)
        FormatMusicPath=trim(strpath)
    End function

    '*****************************************************************
    '    function(公有)
    '    作用 :格式化html
    '*****************************************************************
    Public Function FormatHtml(Str,itype)
        if itype=0 then
            Str=replace(Str,chr(39),"'") 
            Str=replace(Str,chr(34),""") 
            Str=replace(Str,"<","<") 
            Str=replace(Str,">",">") 
        else
            Str=replace(Str,"chr(39)","") 
            Str=replace(Str,"chr(34)","") 
        end if
        FormatHtml=Str
    End function 

    '*****************************************************************
    '    function(公有)
    '    作用 :截取字符
    '    参数 :str要操作的对像,start开始字符,last结束字符,n模式
    '*****************************************************************
    Public Function GetContent(byref str,byref start,byref last,byref n)
        If Instr(lcase(str),lcase(start))>0 then
            select case n
            case 0    '左右都截取(都取前面)(去处关键字)
            GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))-Len(start)+1)
            GetContent=Left(GetContent,Instr(lcase(GetContent),lcase(last))-1)
            case 1    '左右都截取(都取前面)(保留关键字)
            GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))+1)
            GetContent=Left(GetContent,Instr(lcase(GetContent),lcase(last))+Len(last)-1)
            case 2    '只往右截取(取前面的)(去除关键字)
            GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))-Len(start)+1)
            case 3    '只往右截取(取前面的)(包含关键字)
            GetContent=Right(str,Len(str)-Instr(lcase(str),lcase(start))+1)
            case 4    '只往左截取(取后面的)(包含关键字)
            GetContent=Left(str,InstrRev(lcase(str),lcase(start))+Len(start)-1)
            case 5    '只往左截取(取后面的)(去除关键字)
            GetContent=Left(str,InstrRev(lcase(str),lcase(start))-1)
            case 6    '只往左截取(取前面的)(包含关键字)
            GetContent=Left(str,Instr(lcase(str),lcase(start))+Len(start)-1)
            case 7    '只往右截取(取后面的)(包含关键字)
            GetContent=Right(str,Len(str)-InstrRev(lcase(str),lcase(start))+1)
            case 8    '只往左截取(取前面的)(去除关键字)
            GetContent=Left(str,Instr(lcase(str),lcase(start))-1)
            case 9    '只往右截取(取后面的)(包含关键字)
            GetContent=Right(str,Len(str)-InstrRev(lcase(str),lcase(start)))
            end select
        Else
            GetContent=""
        End if
    End function