ASP櫓寧몸俚륜눔뇹잿잚

2018-09-06 11:46

阅读:429

  릿齡덜쯤 덜쯤흔苟:
<%
classStringOperations
****************************************************************************
@묘콘綱츠:겉俚륜눔뻣槨char謹鑒莉
@꽝鑒綱츠:-str[string]:矜狼瘻뻣돨俚륜눔
@럿쀼令:-[Array]Char謹鑒莉
****************************************************************************
publicfunctiontoCharArray(byValstr)
redimcharArray(len(str))
fori=1tolen(str)
charArray(i-1)=Mid(str,i,1)
next
toCharArray=charArray
endfunction
****************************************************************************
@묘콘綱츠:겉寧몸鑒莉瘻뻣냥寧몸俚륜눔
@꽝鑒綱츠:-arr[Array]:矜狼瘻뻣돨鑒앴
@럿쀼令:-[string]俚륜눔
****************************************************************************
publicfunctionarrayToString(byValarr)
fori=0toUBound(arr)
strObj=strObj&arr(i)
next
arrayToString=strObj
endfunction
****************************************************************************
@묘콘綱츠:쇱꿴都俚륜눔str角뤠鹿chars역庫
@꽝鑒綱츠:-str[string]:都俚륜눔
@꽝鑒綱츠:-chars[string]:궐싹돨俚륜/俚륜눔
@럿쀼令:-[bool]
****************************************************************************
publicfunctionstartsWith(byValstr,chars)
ifLeft(str,len(chars))=charsthen
startsWith=true
else
startsWith=false
endif
endfunction
****************************************************************************
@묘콘綱츠:쇱꿴都俚륜눔str角뤠鹿chars써棺
@꽝鑒綱츠:-str[string]:都俚륜눔
@꽝鑒綱츠:-chars[string]:궐싹돨俚륜/俚륜눔
@럿쀼令:-[bool]
****************************************************************************
publicfunctionendsWith(byValstr,chars)
ifRight(str,len(chars))=charsthen
endsWith=true
else
endsWith=false
endif
endfunction
****************************************************************************
@묘콘綱츠:릿齡N몸俚륜눔str
@꽝鑒綱츠:-str[string]:都俚륜눔
@꽝鑒綱츠:-n[int]:릿齡늴鑒
@럿쀼令:-[string]릿齡빈돨俚륜눔
****************************************************************************
publicfunctionclone(byValstr,n)
fori=1ton
value=value&str
next
clone=value
endfunction
****************************************************************************
@묘콘綱츠:?쓱兇닝囹慧str돨품N몸俚륜
@꽝鑒綱츠:-str[string]:都俚륜눔
@꽝鑒綱츠:-n[int]:?쓱壎켰囹醯輜?
@럿쀼令:-[string]?쓱訓捉켰囹慧
****************************************************************************
publicfunctiontrimStart(byValstr,n)
value=Mid(str,n+1)
trimStart=value
endfunction
****************************************************************************
@묘콘綱츠:?쓱兇닝囹慧str돨離빈N몸俚륜눔
@꽝鑒綱츠:-str[string]:都俚륜눔
@꽝鑒綱츠:-n[int]:?쓱壎켰囹醯輜?
@럿쀼令:-[string]?쓱訓捉켰囹慧
****************************************************************************
publicfunctiontrimEnd(byValstr,n)
value=Left(str,len(str)-n)
trimEnd=value
endfunction
****************************************************************************
@묘콘綱츠:쇱꿴俚륜character角뤠角亶匡俚륜A-Zora-z
@꽝鑒綱츠:-character[char]:쇱꿴돨俚륜
@럿쀼令:-[bool]흔벎角亶匡俚륜,럿쀼TRUE,럽裂槨FALSE
****************************************************************************
publicfunctionisAlphabetic(byValcharacter)
asciiValue=cint(asc(character))
if(65<=asciiValueandasciiValue<=90)or(97<=asciiValueandasciiValue<=122)then
isAlphabetic=true
else
isAlphabetic=false
endif
endfunction
****************************************************************************
@묘콘綱츠:뚤str俚륜눔쏵契댕鬼畇瘻뻣
@꽝鑒綱츠:-str[string]:都俚륜눔
@럿쀼令:-[string]瘻뻣빈돨俚륜눔
****************************************************************************
publicfunctionswapCase(str)
fori=1tolen(str)
current=mid(str,i,1)
ifisAlphabetic(current)then
high=asc(ucase(current))
low=asc(lcase(current))
sum=high+low
return=return&chr(sum-asc(current))
else
return=return&current
endif
next
swapCase=return
endfunction
****************************************************************************
@묘콘綱츠:쉥都俚륜눔str櫓첼몸데늦돨뒤寧몸俚캡瘻뻣냥댕畇
@꽝鑒綱츠:-str[string]:都俚륜눔
@럿쀼令:-[string]瘻뻣빈돨俚륜눔
****************************************************************************
publicfunctioncapitalize(str)
words=split(str,)
fori=0toubound(words)
ifnoti=0then
tmp=
endif
tmp=tmp&ucase(left(words(i),1))&right(words(i),len(words(i))-1)
words(i)=tmp
next
capitalize=arrayToString(words)
endfunction
****************************************************************************
@묘콘綱츠:쉥都俚륜Str빈櫓돨법쫀槨
@꽝鑒綱츠:-str[string]:都俚륜눔
@럿쀼令:-[string]瘻뻣빈돨俚륜눔
****************************************************************************
publicfunctioncheckstr(Str)
IfTrim(Str)=OrIsNull(str)Then
checkstr=
else
checkstr=Replace(Trim(Str),,)
endif
Endfunction
****************************************************************************
@묘콘綱츠:쉥俚륜눔櫓돨str櫓돨HTML덜쯤쏵契법쫀
@꽝鑒綱츠:-str[string]:都俚륜눔
@럿쀼令:-[string]瘻뻣빈돨俚륜눔
****************************************************************************
PublicFunctionHtmlEncode(str)
IfTrim(Str)=OrIsNull(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
endif
EndFunction
****************************************************************************
@묘콘綱츠:셕炬都俚륜눔Str돨낀똑(寧몸櫓匡俚륜槨2몸俚쌘낀)
@꽝鑒綱츠:-str[string]:都俚륜눔
@럿쀼令:-[Int]都俚륜눔돨낀똑
****************************************************************************
PublicFunctionstrLen(Str)
IfTrim(Str)=OrIsNull(str)Then
strlen=0
else
DimP_len,x
P_len=0
StrLen=0
P_len=Len(Trim(Str))
Forx=1ToP_len
IfAsc(Mid(Str,x,1))<0Then
StrLen=Int(StrLen)+2
Else
StrLen=Int(StrLen)+1
EndIf
Next
endif
EndFunction
****************************************************************************
@묘콘綱츠:쌔혤都俚륜눔Str돨품LenNum몸俚륜(寧몸櫓匡俚륜槨2몸俚쌘낀)
@꽝鑒綱츠:-str[string]:都俚륜눔
@꽝鑒綱츠:-LenNum[int]:쌔혤돨낀똑
@럿쀼令:-[string]:瘻뻣빈돨俚륜눔
****************************************************************************
PublicFunctionCutStr(Str,LenNum)
DimP_num
DimI,X
IfStrLen(Str)<=LenNumThen
Cutstr=Str
Else
P_num=0
X=0
DoWhileNotP_num>LenNum-2
X=X+1
IfAsc(Mid(Str,X,1))<0Then
P_num=Int(P_num)+2
Else
P_num=Int(P_num)+1
EndIf
Cutstr=Left(Trim(Str),X)&...
Loop
EndIf
EndFunction
endclass
%>


评论


亲,登录后才可以留言!