• <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

            精品一区二区久久久久久久网站| 久久久99精品成人片中文字幕| 亚洲精品乱码久久久久久蜜桃 | 人妻精品久久久久中文字幕69| 日本强好片久久久久久AAA| 日韩精品国产自在久久现线拍| 久久天天日天天操综合伊人av| 久久亚洲AV无码精品色午夜麻豆 | 国产午夜精品久久久久九九电影 | 亚洲国产另类久久久精品黑人| 9久久9久久精品| 久久婷婷是五月综合色狠狠| 99久久无色码中文字幕| 一级做a爰片久久毛片毛片| 狠狠色丁香久久婷婷综| 国产色综合久久无码有码| 久久中文娱乐网| 精品人妻久久久久久888| 一本久久免费视频| 88久久精品无码一区二区毛片 | 丁香五月综合久久激情| 人妻精品久久久久中文字幕一冢本| 国产精品九九久久免费视频 | 99精品国产综合久久久久五月天| 国产精品美女久久久久av爽 | 亚洲中文精品久久久久久不卡| 精品无码久久久久久久久久| 久久99国产亚洲高清观看首页 | 亚洲va久久久噜噜噜久久天堂| 色偷偷88欧美精品久久久| 久久99精品国产麻豆不卡| 久久精品国产亚洲麻豆| 国内精品久久久久久久97牛牛| 久久精品a亚洲国产v高清不卡| 亚洲中文精品久久久久久不卡| 亚洲午夜久久久久久噜噜噜| 狠狠色婷婷久久一区二区| 77777亚洲午夜久久多人| 亚洲精品tv久久久久久久久 | 合区精品久久久中文字幕一区| 久久免费观看视频|