O maior centro de demonstração da estação legal da China!
Esta classe é usada para processar string, que é escrita por estrangeiros.
Como usar:
=====================================
<!-#inclua arquivo = stringoperations.asp->
<%
Dim str
set str = novas operações de strings
Teste = str.tocarray (confira isso)
Response.write <strong> str.tocharray </strong>:
para i = 0 para ubound (teste)
Response.Write Test (i) e
próximo
Response.write <br> <br>
test1 = stra.arraytring (teste)
Response.write <strong> str.arraytring </strong>: & test1
Response.write <br> <br>
Response.write <strong> str.startswith </strong>: & str.startswith (test1, ch)
Response.write <br> <br>
Response.write <strong> str.endwith </strong>: & strongswith (test1, out)
Response.write <br> <br>
Response.write <strong> str.clone </strong>: & str.clone (ABC, 10)
Response.write <br> <br>
Response.write <strong> str.trimstart </strong>: & strimstart (test1, 3)
Response.write <br> <br>
Response.write <strong> str.trimend </strong>: & strongr.trimend (test1, 2)
Response.write <br> <br>
Response.write <strong> str.swapcase </strong>: & str.swapcase (hihihi) (hihihi)
Response.write <br> <br>
Response.write <strong> str.isalphabetic </strong>: & str.isalphbetic (!)
Response.write <br> <br>
Response.write <strong> str.capitalize </strong>: & str.Capitalize (Clara Fehler)
Definir str = nada
%>
=============== StringOperations.asp ================
<%
Classe StringOperations
'********************************************** *** ************************************
'' @Function Descrição: Substitua a string pela matriz do tipo de char
'' @Parameter Descrição: -dr [string]: string que precisa ser convertida
'' @Return Valor: - [Array] Char Type Array
'********************************************** *** ************************************
Funções públicas
Redim Chararray (Len (STR))
para i = 1 a len (str)
CharArray (I-1) = MID (STR, I, 1)
próximo
Tocarrray = CharArray
Função final
'********************************************** *** ************************************
'' @Function Descrição: converta uma matriz em uma string
'' @Parameter Descrição: -arr [Array]: Dados precisavam ser convertidos
'' @Return valor: - [string] string
'********************************************** *** ************************************
Funções públicas (BYVAL ARR)
para i = 0 para ubound (arr)
Strobj = strobj & arr (i)
próximo
Arraytring = strobj
Função final
'********************************************** *** ************************************
'' @Function Descrição: Verifique se a string de origem STR começa com chars
'' @Parameter Descrição: -str [string]: string de origem
'' @Parameter Descrição: -Chars [String]: Caractere/String de comparação
'' @Return valor: - [bool]
'********************************************** *** ************************************
Função pública StartSwith (Byval Str, Chars)
se esquerdo (str, len (chars)) = chars então
startSwith = true
outro
startSwith = false
final se
Função final
'********************************************** *** ************************************
'' @Function Descrição: Verifique se a string de origem termina com chars
'' @Parameter Descrição: -str [string]: string de origem
'' @Parameter Descrição: -Chars [String]: Caractere/String de comparação
'' @Return valor: - [bool]
'********************************************** *** ************************************
Função pública ENDSWITH (BYVAL STR, CHARS)
Se certo (str, len (chars)) = chars então
endswith = true
outro
endswith = false
final se
Função final
'********************************************** *** ************************************
'' @Function Descrição: copy n string str
'' @Parameter Descrição: -str [string]: string de origem
'' @Parameter Descrição: -n [int]: número de réplicas
'' @Return valor: - [string] cópia string
'********************************************** *** ************************************
Clone de função pública (BYVAL STR, N)
para i = 1 a n
Valor = valor e str
próximo
clone = valor
Função final
'********************************************** *** **************
|||A maior estação de download de recursos de origem do site,
*******************'' @Function Descrição: Exclua os caracteres da frente da frente da string de origem str
'' @Parameter Descrição: -str [string]: string de origem
'' @Parameter Descrição: -n [int]: Número de caracteres excluídos
'' @Return valor: - [string] String deletada
'********************************************** *** ************************************
Função pública TRIMSTART (BYVAL STR, N)
Valor = mid (str, n+1)
Trimstart = Valor
Função final
'********************************************** *** ************************************
'' @Function Descrição: Exclua a última string n da string de origem str
'' @Parameter Descrição: -str [string]: string de origem
'' @Parameter Descrição: -n [int]: Número de caracteres excluídos
'' @Return valor: - [string] String deletada
'********************************************** *** ************************************
Função pública Trimend (Byval Str, N)
Valor = esquerda (str, len (str) -n)))
trimend = valor
Função final
'********************************************** *** ************************************
'' @Function Descrição: Verifique se o personagem é o personagem inglês AZ ou AZ
'' @Parameter Descrição: -Character [char]: o personagem foi verificado
'' @Return valor: - [bool] Se for um personagem em inglês, retorne verdadeiro, caso contrário, falsa
'********************************************** *** ************************************
Funções públicas
Asciivalue = cint (ASC (caractere))
if (65 <= asciivalue e asciivalue <= 90) ou (97 <= asciivalue e asciivalue <= 122) então
Isalphabetic = true
outro
Isalphabetic = falso
final se
Função final
'********************************************** *** ************************************
'' @Function Nota: Execute uma conversão minúscula da string str
'' @Parameter Descrição: -str [string]: string de origem
'' @Return valor: - [string] A sequência convertida
'********************************************** *** ************************************
Swapcase de função pública (STR)
para i = 1 a len (str)
Atual = mid (str, i, 1)
Se isalfabético (atual) então
High = ASC (UCase (Current))
Low = ASC (LCase (corrente))
Soma = alto + baixo
Return = return & chr (sum-asc (atual))
outro
Return = retorno e corrente
final se
próximo
swapcase = retornar
Função final
'********************************************** *** ************************************
'' @Function Descrição: Converta a primeira letra de cada palavra na string de origem STR em maiúsculas
'' @Parameter Descrição: -str [string]: string de origem
'' @Return valor: - [string] A sequência convertida
'********************************************** *** ************************************
Função pública capitaliza (STR)
Palavras = dividir (str,)
para i = 0 para ubound (palavras)
se não i = 0 então
Tmp =
final se
Tmp = tmp & ucase (esquerda (palavras (i), 1)) e direita (palavras (i), len (palavras (i))-1)
palavras (i) = tmp
próximo
capitalize = Arraytring (palavras)
Função final
Classe final
%>