vbscript| string |vbscript| string related articles see:
http://www.csdn.net/Develop/read_article.asp?id=22695
This article on the basis of a number of additions, add a few suitable for Chinese web site function to go in, there may be some did not add, there are interested friends can then add a little function on this basis, but don't forget to share!
<%
Class Stringoperations
'****************************************************************************
' @ Feature Description: Swap string for char-type array
' @ parameter Description:-str [string]: a string to convert
' @ return value:-[array] char array
'****************************************************************************
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
'****************************************************************************
' @ Function Description: Converts an array into a string
' @ parameter Description:-arr [Array]: data that needs to be converted
' @ return Value:-[string] string
'****************************************************************************
Public Function arraytostring (ByVal arr)
For i = 0 to UBound (arr)
Strobj = strobj & Arr (i)
Next
arraytostring = Strobj
End Function
'****************************************************************************
' @ Feature Description: Check source string str starts with chars
' @ parameter Description:-str [string]: source string
' @ parameter Description:-chars [string]: Character/string of comparison
' @ return value:-[bool]
'****************************************************************************
Public function StartsWith (ByVal str, chars)
If left (Str,len (chars)) = Chars Then
StartsWith = True
Else
StartsWith = False
End If
End Function
'****************************************************************************
' @ Feature Description: Check source string str to end with chars
' @ parameter Description:-str [string]: source string
' @ parameter Description:-chars [string]: Character/string of comparison
' @ return value:-[bool]
'****************************************************************************
Public Function EndsWith (ByVal str, chars)
If Right (Str,len (chars)) = Chars Then
EndsWith = True
Else
EndsWith = False
End If
End Function
'****************************************************************************
' @ Feature Description: Copy n string str
' @ parameter Description:-str [string]: source string
' @ parameter Description:-n [int]: number of copies
"@ return Value:-[string] copied string
'****************************************************************************
Public Function Clone (ByVal str, n)
For i = 1 to n
Value = value & str
Next
Clone = value
End Function
'****************************************************************************
' @ Feature Description: Delete source string The first n characters of str
' @ parameter Description:-str [string]: source string
' @ parameter Description:-n [int]: number of characters deleted
"@ return Value:-[string] deleted string
'****************************************************************************
Public function TrimStart (ByVal str, n)
Value = Mid (str, n+1)
TrimStart = value
End Function
'****************************************************************************
' @ Feature Description: Deletes the last n string of the source string str
' @ parameter Description:-str [string]: source string
' @ parameter Description:-n [int]: number of characters deleted
"@ return Value:-[string] deleted string
'****************************************************************************
Public function trimend (ByVal str, n)
Value = Left (str, Len (str)-N)
TrimEnd = value
End Function
'****************************************************************************
' @ Feature Description: Check character character is English character A-Z or a-Z
' @ parameter Description:-character [char]: Character checked
' @ return value:-[bool] If it is an English character, returns true, False instead
'*******************
[1] [2] [3] Next page