Hola a todos.
Aquí le propongo una función que convierte un texto en otro que solo contiene caracteres alfanuméricos.
Por favor si alguien tiene una mejor idea por favor no dude en compartirla.
Código:
'' Alphanumericals are a combination of alphabetical and numerical characters, and is used to describe the collection of Latin letters and Arabic digits or a text constructed from this collection.
Static Public Function Alphanumeric(strInput As String) As String
Dim int As Integer
Dim strSymbol As String
Dim stxLeters As New String[]
Dim intKey As Integer
Dim stxOut As New String[]
Dim strOut As String
Dim stxRepin As New String[]
Dim stxRepout As New String[]
Dim intRep As Integer
stxOut.Clear
stxLeters.Clear
stxLeters = Split(":a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z: :A:B:C:D:E:F:G:H:I:J:K:L:M:N:O:P:Q:R:S:T:U:V:W:X:Y:Z:á:à:â:ã:é:è:ê:í:ï:ó:ô:õ:ö:ú:ç:ñ:Á:À:Â:Ã:É:È:Ê:Í:Ï:Ó:Ô:Õ:Ö:Ú:Ç:Ñ:0:1:2:3:4:5:6:7:8:9", ":")
stxRepin = Split("Á:À:Â:Ã:É:È:Ê:Í:Ï:Ó:Ô:Õ:Ö:Ú:Ñ:á:à:â:ã:é:è:ê:í:ï:ó:ô:õ:ö:ú:ñ", ":")
stxRepout = Split("A:A:A:A:E:E:E:I:I:O:O:O:O:U:N:a:a:a:a:e:e:e:i:i:o:o:o:o:u:n", ":")
For int = 1 To String.Len(strInput)
strSymbol = String.Mid(strInput, int, 1)
intKey = stxLeters.Find(strSymbol)
If intKey > -1 Then
intRep = stxRepin.Find(strSymbol)
If intRep > -1 Then
strSymbol = stxRepout[intRep]
Endif
stxOut.Add(strSymbol)
End If
Next
strOut = stxOut.Join("")
Return strOut
End
Saludos.