最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

ASP中一個(gè)字符串處理類

 更新時(shí)間:2006年08月27日 00:00:00   作者:  
復(fù)制代碼 代碼如下:

<%
class StringOperations
''****************************************************************************
'''' @功能說(shuō)明: 把字符串換為char型數(shù)組
'''' @參數(shù)說(shuō)明:  - str [string]: 需要轉(zhuǎn)換的字符串
'''' @返回值:   - [Array] Char型數(shù)組
''****************************************************************************
public function toCharArray(byVal str)
 redim charArray(len(str))
 for i = 1 to len(str)
  charArray(i-1) = Mid(str,i,1)
 next
 toCharArray = charArray
end function
''****************************************************************************
'''' @功能說(shuō)明: 把一個(gè)數(shù)組轉(zhuǎn)換成一個(gè)字符串
'''' @參數(shù)說(shuō)明:  - arr [Array]: 需要轉(zhuǎn)換的數(shù)據(jù)
'''' @返回值:   - [string] 字符串
''****************************************************************************
public function arrayToString(byVal arr)
 for i = 0 to UBound(arr)
  strObj = strObj & arr(i)
 next
 arrayToString = strObj
end function
''****************************************************************************
'''' @功能說(shuō)明: 檢查源字符串str是否以chars開(kāi)頭
'''' @參數(shù)說(shuō)明:  - str [string]: 源字符串
'''' @參數(shù)說(shuō)明:  - chars [string]: 比較的字符/字符串
'''' @返回值:   - [bool]
''****************************************************************************
public function startsWith(byVal str, chars)
 if Left(str,len(chars)) = chars then
  startsWith = true
 else
  startsWith = false
 end if
end function
''****************************************************************************
'''' @功能說(shuō)明: 檢查源字符串str是否以chars結(jié)尾
'''' @參數(shù)說(shuō)明:  - str [string]: 源字符串
'''' @參數(shù)說(shuō)明:  - 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
''****************************************************************************
'''' @功能說(shuō)明: 復(fù)制N個(gè)字符串str
'''' @參數(shù)說(shuō)明:  - str [string]: 源字符串
'''' @參數(shù)說(shuō)明:  - n [int]: 復(fù)制次數(shù)
'''' @返回值:   - [string] 復(fù)制后的字符串
''****************************************************************************
public function clone(byVal str, n)
 for i = 1 to n
  value = value & str
 next
 clone = value
end function
''****************************************************************************
'''' @功能說(shuō)明: 刪除源字符串str的前N個(gè)字符
'''' @參數(shù)說(shuō)明:  - str [string]: 源字符串
'''' @參數(shù)說(shuō)明:  - n [int]: 刪除的字符個(gè)數(shù)
'''' @返回值:   - [string] 刪除后的字符串
''****************************************************************************
public function trimStart(byVal str, n)
 value = Mid(str, n+1)
 trimStart = value
end function
''****************************************************************************
'''' @功能說(shuō)明: 刪除源字符串str的最后N個(gè)字符串
'''' @參數(shù)說(shuō)明:  - str [string]: 源字符串
'''' @參數(shù)說(shuō)明:  - n [int]: 刪除的字符個(gè)數(shù)
'''' @返回值:   - [string] 刪除后的字符串
''****************************************************************************
public function trimEnd(byVal str, n)
 value = Left(str, len(str)-n)
 trimEnd = value
end function
''****************************************************************************
'''' @功能說(shuō)明: 檢查字符character是否是英文字符 A-Z or a-z
'''' @參數(shù)說(shuō)明:  - 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
''****************************************************************************
'''' @功能說(shuō)明: 對(duì)str字符串進(jìn)行大小寫轉(zhuǎn)換
'''' @參數(shù)說(shuō)明:  - str [string]: 源字符串
'''' @返回值:   - [string] 轉(zhuǎn)換后的字符串
''****************************************************************************
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
''****************************************************************************
'''' @功能說(shuō)明: 將源字符串str中每個(gè)單詞的第一個(gè)字母轉(zhuǎn)換成大寫
'''' @參數(shù)說(shuō)明:  - str [string]: 源字符串
'''' @返回值:   - [string] 轉(zhuǎn)換后的字符串
''****************************************************************************
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
''****************************************************************************
'''' @功能說(shuō)明: 將源字符Str后中的''過(guò)濾為''''
'''' @參數(shù)說(shuō)明:  - str [string]: 源字符串
'''' @返回值:   - [string] 轉(zhuǎn)換后的字符串
''****************************************************************************
public function checkstr(Str)
 If Trim(Str)="" Or IsNull(str) Then
  checkstr=""
 else
  checkstr=Replace(Trim(Str),"''","''''")
 end if
End function
''****************************************************************************
'''' @功能說(shuō)明: 將字符串中的str中的HTML代碼進(jìn)行過(guò)濾
'''' @參數(shù)說(shuō)明:  - str [string]: 源字符串
'''' @返回值:   - [string] 轉(zhuǎn)換后的字符串
''****************************************************************************
Public Function HtmlEncode(str)
 If Trim(Str)="" Or IsNull(str) then
  HtmlEncode=""
 else
  str=Replace(str,">",">")
  str=Replace(str,"<","<")
  str=Replace(str,Chr(32)," ")
  str=Replace(str,Chr(9)," ")
  str=Replace(str,Chr(34),""")
  str=Replace(str,Chr(39),"'")
  str=Replace(str,Chr(13),"")
  str=Replace(str,Chr(10) & Chr(10), "</p><p>")
  str=Replace(str,Chr(10),"<br> ")
  HtmlEncode=str
 end if
End Function
''****************************************************************************
'''' @功能說(shuō)明: 計(jì)算源字符串Str的長(zhǎng)度(一個(gè)中文字符為2個(gè)字節(jié)長(zhǎng))
'''' @參數(shù)說(shuō)明:  - str [string]: 源字符串
'''' @返回值:   - [Int] 源字符串的長(zhǎng)度
''****************************************************************************
Public Function strLen(Str)
 If Trim(Str)="" Or IsNull(str) Then
  strlen=0
 else
  Dim P_len,x
  P_len=0
  StrLen=0
  P_len=Len(Trim(Str))
  For x=1 To P_len
   If Asc(Mid(Str,x,1))<0 Then
    StrLen=Int(StrLen) + 2
   Else
    StrLen=Int(StrLen) + 1
   End If
  Next
 end if
End Function
''****************************************************************************
'''' @功能說(shuō)明: 截取源字符串Str的前LenNum個(gè)字符(一個(gè)中文字符為2個(gè)字節(jié)長(zhǎng))
'''' @參數(shù)說(shuō)明:  - str [string]: 源字符串
'''' @參數(shù)說(shuō)明:  - LenNum [int]: 截取的長(zhǎng)度
'''' @返回值:   - [string]: 轉(zhuǎn)換后的字符串
''****************************************************************************
Public Function CutStr(Str,LenNum)
 Dim P_num
 Dim I,X
 If StrLen(Str)<=LenNum Then
  Cutstr=Str
 Else
  P_num=0
  X=0
  Do While Not P_num > LenNum-2
   X=X+1
   If Asc(Mid(Str,X,1))<0 Then
    P_num=Int(P_num) + 2
   Else
    P_num=Int(P_num) + 1
   End If
   Cutstr=Left(Trim(Str),X)&"..."
  Loop
 End If
End Function
end class
%>

相關(guān)文章

  • 文章內(nèi)頁(yè)類

    文章內(nèi)頁(yè)類

    文章內(nèi)頁(yè)類...
    2006-10-10
  • ASP類Class入門 推薦

    ASP類Class入門 推薦

    我們常??吹絼e的程序語(yǔ)言中中都有類的說(shuō)明,PHP,VB,C++,這個(gè)在VBScript中的類的說(shuō)明,我是第一次聽(tīng)到,我們的日常工作就是網(wǎng)站開(kāi)發(fā),在這個(gè)里面多多少少搞出點(diǎn)經(jīng)驗(yàn),像模像樣也能自詡為內(nèi)行,所以我就來(lái)分享一下我所知道的這個(gè)新的東東
    2006-08-08
  • 最新評(píng)論

    武隆县| 滕州市| 晋州市| 宜州市| 晴隆县| 军事| 宜兴市| 沙坪坝区| 稻城县| 民勤县| 昌黎县| 庆城县| 隆昌县| 措勤县| 甘孜县| 赣州市| 舒兰市| 泸西县| 罗甸县| 揭东县| 明光市| 徐水县| 潮州市| 汾西县| 织金县| 佳木斯市| 成安县| 莱西市| 扎赉特旗| 齐河县| 搜索| 临武县| 巴楚县| 习水县| 曲周县| 萍乡市| 勐海县| 汾阳市| 资溪县| 冕宁县| 麻栗坡县|