Decodifica uma string de URL
Function UnEscape(ByVal Str)
Dim i, Nova, h, j, c, ln
For i = 1 To 255
h = Hex(i)
If Len(h) = 1 Then h = "0" & h
h = "%" & h
Str = eregi_replace(h, Chr(i), Str)
Next
UnEscape = Str
End Function
Este blog é originalmente para ser um banco de funções e procedimentos públicas de qualquer linguagem, como a minha especialidade é liguagens Microsoft® vou me ater a elas, mas caso haja pessoas interessadas em passar funções ou procedimentos de outras linguagens, sintam-se a vontade para envia-las a mim.
quinta-feira, 28 de fevereiro de 2008
quarta-feira, 27 de fevereiro de 2008
TrimChop()
Remove seqüências de caracteres brancos de dentro da string
Function TrimChop(ByVal Str)
Dim i, rm, c, nw, a
Str = Trim(Str)
nw = ""
rm = False
For i = 1 To Len(Str)
c = Mid(Str, i, 1)
a = Asc(c)
If a < 33 Or a = 160 Then
If Not rm Then
rm = True
nw = nw & c
End If
Else
rm = False
nw = nw & c
End If
Next
TrimChop = nw
End Function
Function TrimChop(ByVal Str)
Dim i, rm, c, nw, a
Str = Trim(Str)
nw = ""
rm = False
For i = 1 To Len(Str)
c = Mid(Str, i, 1)
a = Asc(c)
If a < 33 Or a = 160 Then
If Not rm Then
rm = True
nw = nw & c
End If
Else
rm = False
nw = nw & c
End If
Next
TrimChop = nw
End Function
quinta-feira, 21 de fevereiro de 2008
StripTags
Função que remove todas as tags HTML
Function StripTags(ByRef Str)
Str = Str & ""
If Str = "" Then
StripTags = ""
Exit Function
End If
Dim nw, i, j, c, k, x
i = 1
x = 1
k = Len(Str)
nw = ""
Do While i > 0
i = InStr(i, Str, "<")
If i = 0 Then Exit Do
j = InStr(i, Str, ">")
If j < i Then Exit Do
c = Mid(Str, i + 1, 1)
If ereg("^[a-zA-Z/!]$", c) Then
nw = nw & Mid(Str, x, i - x)
i = j + 1
x = i
Else
i = i + 1
End If
If i >= k Then Exit Do
Loop
nw = nw & Mid(Str, x, k - x + 1)
StripTags = nw
End Function
Assinar:
Postagens (Atom)