Le plus grand centre de démonstration de la station cool en Chine!
Cette classe est utilisée pour traiter la chaîne, qui est écrite par des étrangers.
Comment utiliser:
================================================.
<! - # include file = stringoperations.asp->
<%
Schem
Définir STR = NOUVELLESOperations
Test = str.tocharray (vérifiez ceci)
réponse.write <strong> str.tocharray </strong>:
pour i = 0 à Ubound (test)
Response.Write Test (i) &
suivant
réponse.WRITE <br> <br>
test1 = strat.arraytring (test)
réponse.write <strong> str.arraytring </strong>: & test1
réponse.WRITE <br> <br>
réponse.write <strong> str.startswith </strong>: & str.startswith (test1, ch)
réponse.WRITE <br> <br>
réponse.write <strong> str.endwith </strong>: & Strongswith (test1, out)
réponse.WRITE <br> <br>
réponse.write <strong> str.clone </strong>: & str.clone (ABC, 10)
réponse.WRITE <br> <br>
réponse.write <strong> str.trimstart </strong>: & Strimstart (test1, 3)
réponse.WRITE <br> <br>
réponse.write <strong> str.triMend </strong>: & Strongr.triMend (test1, 2)
réponse.WRITE <br> <br>
réponse.write <strong> str.swapcase </strong>: & str.swapcase (hihihi) (hihihi)
réponse.WRITE <br> <br>
réponse.write <strong> str.isalphabetic </strong>: & str.isalphbetic (!)
réponse.WRITE <br> <br>
Response.Write <strong> Str.Capitalize </strong>: & Str.Capitalize (Clara Fehler)
Set str = rien
%>
=============== StringOperations.asp ===============
<%
Classe StringOperations
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
'' @Function Description: Remplacez la chaîne par le tableau de type charbon
'' @Paramètre Description: -dr [chaîne]: chaîne qui doit être convertie
'' @Return Value: - [Array] Array de type charbon
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
Fonctions publiques
Redim Chararray (Len (Str))
pour i = 1 à Len (str)
chararray (i-1) = mid (str, i, 1)
suivant
Tocharrray = chararray
fonction finale
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
'' @Function Description: Convertir un tableau en une chaîne
'' @Paramètre Description: -arr [array]: les données doivent être converties
'' @Return Value: - [String] String
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
Fonctions publiques (byval arr)
pour i = 0 à Ubound (arr)
Strobj = strobj & arr (i)
suivant
Arraytring = strobj
fonction finale
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
'' @Function Description: Vérifiez si la chaîne source STR commence par Chars
'' @Paramètre Description: -str [chaîne]: chaîne source
'' @Paramètre Description: -chars [String]: Caractère de comparaison / chaîne
'' @Return Value: - [bool]
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
Fonction publique Startwith (Byval Str, Chars)
Si vous êtes laissé (str, len (chars))) = Chars alors
startSwith = true
autre
startSwith = false
terminer si
fonction finale
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
'' @Function Description: Vérifiez si la chaîne source STR se termine par Chars
'' @Paramètre Description: -str [chaîne]: chaîne source
'' @Paramètre Description: -chars [String]: Caractère de comparaison / chaîne
'' @Return Value: - [bool]
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
Fonction publique Endswith (Byval Str, Chars)
Si bien (str, len (chars)) = chars alors
Endswith = true
autre
Endswith = false
terminer si
fonction finale
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
'' @Function Description: Copier n String Str
'' @Paramètre Description: -str [chaîne]: chaîne source
'' @Paramètre Description: -n [int]: nombre de répliques
'' @Return Value: - [String] Copier String
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
Clone de fonction publique (Byval Str, N)
pour i = 1 à n
Valeur = valeur et str
suivant
clone = valeur
fonction finale
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *************
|||La plus grande station de téléchargement de ressources de source de site Web,
***************'' @Function Description: Supprimer les n caractères avant de la chaîne source Str
'' @Paramètre Description: -str [chaîne]: chaîne source
'' @Paramètre Description: -n [int]: nombre de caractères supprimés
'' @Return Value: - [String] String supprimé
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
Fonction publique TrimStart (Byval Str, N)
Valeur = mid (str, n + 1)
trimStart = valeur
fonction finale
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
'' @Function Description: Supprimer la dernière chaîne N de la chaîne source Str
'' @Paramètre Description: -str [chaîne]: chaîne source
'' @Paramètre Description: -n [int]: nombre de caractères supprimés
'' @Return Value: - [String] String supprimé
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
Public Function Trind (Byval Str, N)
Valeur = gauche (str, len (str) -n))
trim = valeur
fonction finale
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
'' @Function Description: Vérifiez si le personnage de personnage est le caractère anglais AZ ou AZ
'' @Paramètre Description: -Character [char]: le personnage vérifié
'' @Return Value: - [bool] S'il s'agit d'un personnage anglais, retournez vrai, sinon faux
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
Fonctions publiques
Asciivalue = cint (asc (caractère))
if (65 <= asciivalue et asciialivalue <= 90) ou (97 <= asciialivue et asciialivalue <= 122)
Isalphabetic = true
autre
Isalphabetique = faux
terminer si
fonction finale
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
'' @Function Remarque: Effectuez une conversion en minuscules de la chaîne STR
'' @Paramètre Description: -str [chaîne]: chaîne source
'' @Return Value: - [String] La chaîne convertie
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
Swapcase de fonction publique (STR)
pour i = 1 à Len (str)
Courant = mid (str, i, 1)
Si isalphabétique (courant) alors
Élevé = asc (ucase (courant))
Bas = ASC (LCase (courant))
Sum = haut + bas
Return = return & chr (sum-as (courant))
autre
Return = retour et courant
terminer si
suivant
swapcase = retour
fonction finale
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
'' @Function Description: Convertissez la première lettre de chaque mot dans la chaîne source STR en majuscules
'' @Paramètre Description: -str [chaîne]: chaîne source
'' @Return Value: - [String] La chaîne convertie
'************************************************* **************************************************** **************************************************** **************************************************** **************************************************** **************, *********************************** **
La fonction publique capitalise (STR)
Mots = Split (str,)
pour i = 0 à Ubound (mots)
Sinon i = 0 alors
Tmp =
terminer si
Tmp = tmp & ucase (gauche (mots (i), 1)) & droite (mots (i), len (mots (i)) - 1)
mots (i) = tmp
suivant
capitaliser = arraytring (mots)
fonction finale
classe finale
%>