1
Visual Basic 6 / Re:Obtener solo los numeros de un string
« en: Enero 27, 2015, 12:44:08 pm »Gente este método no falla nunca y es lo más rápido que hay.
Código: [Seleccionar]
Public Class Form1
Private Function obtenerNumeros(pTexto As String)
Dim i As Integer = 0
Dim retorno As String = Nothing
While i < pTexto.Length
If pTexto(i) >= "0" And
pTexto(i) <= "9" Then
retorno += pTexto(i)
End If
i += 1
End While
Return retorno
End Function
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
MsgBox(obtenerNumeros(TextBox1.Text))
End Sub
End Class