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

Nenhum comentário: