A string processing class (Enhanced) (VBScript) in ASP

Source: Internet
Author: User
Related articles See:
http://www.111cn.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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.