• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            elva

            個人擴展的asp字符串函數

            <%
            '' @參數說明: - str [string]: 源字符串
            '' @參數說明: - chars [string]: 比較的字符/字符串
            '' @返回值: - [bool]
            '****************************************************************************
            public function endsWith(byVal str, chars)
            if Right(str,len(chars)) = chars then
            endsWith = true
            else
            endsWith = false
            end if
            end function

            '****************************************************************************
            '' @功能說明: 復制N個字符串str
            '' @參數說明: - str [string]: 源字符串
            '' @參數說明: - n [int]: 復制次數
            '' @返回值: - [string] 復制后的字符串
            '****************************************************************************
            public function clone(byVal str, n)
            for i = 1 to n
            value = value & str
            next
            clone = value
            end function

            '****************************************************************************
            '' @功能說明: 刪除源字符串str的前N個字符
            '' @參數說明: - str [string]: 源字符串
            '' @參數說明: - n [int]: 刪除的字符個數
            '' @返回值: - [string] 刪除后的字符串
            '****************************************************************************
            public function trimStart(byVal str, n)
            value = Mid(str, n+1)
            trimStart = value
            end function

            '****************************************************************************
            '' @功能說明: 刪除源字符串str的最后N個字符串
            '' @參數說明: - str [string]: 源字符串
            '' @參數說明: - n [int]: 刪除的字符個數
            '' @返回值: - [string] 刪除后的字符串
            '****************************************************************************
            public function trimEnd(byVal str, n)
            value = Left(str, len(str)-n)
            trimEnd = value
            end function

            '****************************************************************************
            '' @功能說明: 檢查字符character是否是英文字符 A-Z or a-z
            '' @參數說明: - character [char]: 檢查的字符
            '' @返回值: - [bool] 如果是英文字符,返回TRUE,反之為FALSE
            '****************************************************************************
            public function isAlphabetic(byVal character)
            asciiValue = cint(asc(character))
            if (65 <= asciiValue and asciiValue <= 90) or (97 <= asciiValue and asciiValue <= 122) then
            isAlphabetic = true
            else
            isAlphabetic = false
            end if
            end function

            '****************************************************************************
            '' @功能說明: 對str字符串進行大小寫轉換
            '' @參數說明: - str [string]: 源字符串
            '' @返回值: - [string] 轉換后的字符串
            '****************************************************************************
            public function swapCase(str)
            for i = 1 to len(str)
            current = mid(str, i, 1)
            if isAlphabetic(current) then
            high = asc(ucase(current))
            low = asc(lcase(current))
            sum = high + low
            return = return & chr(sum-asc(current))
            else
            return = return & current
            end if
            next
            swapCase = return
            end function

            '****************************************************************************
            '' @功能說明: 將源字符串str中每個單詞的第一個字母轉換成大寫
            '' @參數說明: - str [string]: 源字符串
            '' @返回值: - [string] 轉換后的字符串
            '****************************************************************************
            public function capitalize(str)
            words = split(str," ")
            for i = 0 to ubound(words)
            if not i = 0 then
            tmp = " "
            end if
            tmp = tmp & ucase(left(words(i), 1)) & right(words(i), len(words(i))-1)
            words(i) = tmp
            next
            capitalize = arrayToString(words)
            end function

            'end class
            '****************************************************************************
            public Function Strlen(txt)
                txt=trim(txt)
                x = len(txt)
                y = 0
                for ii = 1 to x
                    if asc(mid(txt,ii,1)) < 0 or asc(mid(txt,ii,1)) >255 then
                        y = y + 2
                    else
                        y = y + 1
                    end if
                next
                Strlen = y

            End Function


            '****************************************************************************
            '判斷中英文結合的字段串長度的小函數
            '****************************************************************************
            Function Strlength(Str)
            Temp_Str=Len(Str)
            For I=1 To Temp_Str
            Test_Str=(Mid(Str,I,1))
            If Asc(Test_Str)>0 Then
            Strlength=Strlength+1
            Else
            Strlength=Strlength+2
            End If
            Next
            End Function

            Function Strleft(Str,L)
            Temp_Str=Len(Str)
            For I=1 To Temp_Str
            Test_Str=(Mid(Str,I,1))
            Strleft=Strleft&Test_Str
            If Asc(Test_Str)>0 Then
            lens=lens+1
            Else
            lens=lens+2
            End If
            If lens>=L Then Exit For
            Next
            End Function

            Function Strright(Str,L)
            Temp_Str=Len(Str)
            For i = Temp_Str to 1 step -1
            Test_Str=(Mid(Str,I,1))
            Strright=Test_Str&Strright
            If Asc(Test_Str)>0 Then
            lens=lens+1
            Else
            lens=lens+2
            End If
            If lens>=L Then Exit For
            Next
            End Function
            '****************************************************************************
            'len(),lift(),right()不能正常識別中文的解決方法
            '****************************************************************************

             


            '****************************************************************************
            '****************************************************************************
            '****************************Write by elva***********************************
            '****************************************************************************
            '****************************************************************************
            public function getstr(byVal str, x,y)
             value = Left(str,x)
             value = Right(value,y)
             getstr = Ltrimch(value,0)
             'getstr = Rtrimch(value,0)
            end function
            '****************************************************************************
            '' @功能說明: 取得字符串中的某字符串作為新串.x是到此字符串的長度,y是該字符串長度
            ''@返回值,新的字符串
            '****************************************************************************
            public function Ltrimch(byVal str,c)
             value = str
             while (InStr(value,c) = 1)
              value = Mid(value, 2)
             wend
             Ltrimch = value
            end function
            '****************************************************************************
            '' @功能說明: 去掉字符串前面填充的 0
            ''@注:從左面截取。
            '****************************************************************************
            public function Rtrimch(byVal str,c)
             value = str
             'while (Right(value,1) = c)
             while (StrComp(Right(value,1),c) = 0 )
              value = Left(value,len(value)-1)
              'response.write value & "||" & Right(value,1) & "||"& "ok<br>"
             wend
             response.write Right(value,1) & "<br>"
             Rtrimch = value
            end function
            '****************************************************************************
            '' @功能說明: 去掉字符串前面填充的 0
            ''@注:從右面截取。
            '****************************************************************************
            %>

            posted on 2007-05-28 23:39 葉子 閱讀(445) 評論(0)  編輯 收藏 引用 所屬分類: ASP

            国内精品久久久久久久97牛牛 | 久久人人爽人人精品视频| 久久国产精品一国产精品金尊| 久久国产精品99精品国产| 久久这里只有精品久久| 欧美久久一级内射wwwwww.| 99蜜桃臀久久久欧美精品网站| 99久久99久久久精品齐齐| 久久狠狠一本精品综合网| 久久综合给久久狠狠97色| 国内精品久久久久影院网站| 久久精品国产99国产精品亚洲 | 女人高潮久久久叫人喷水| 欧美一区二区三区久久综| 久久99精品久久久久久野外 | 99久久99这里只有免费费精品| 久久综合综合久久狠狠狠97色88| 亚州日韩精品专区久久久| 久久久久久人妻无码| 久久综合久久综合亚洲| 久久艹国产| 久久免费美女视频| 久久综合香蕉国产蜜臀AV| 久久久久久久久波多野高潮| 久久久久亚洲精品天堂久久久久久| 久久久久久亚洲Av无码精品专口| 亚洲国产精品综合久久网络| 色综合久久中文综合网| 成人久久综合网| 国产精品久久久久天天影视 | 97精品伊人久久大香线蕉app| 精品久久久一二三区| 久久天天婷婷五月俺也去| 久久久久久国产a免费观看不卡| 日本免费久久久久久久网站| 国产精品久久久久AV福利动漫| 久久人人爽人人爽人人片AV不| 一本色道久久综合亚洲精品| 亚洲国产欧美国产综合久久| 中文字幕热久久久久久久| 久久免费看黄a级毛片|