
Function GetInt(ByVal input As String) As Integer
Dim reg As Regex = New Regex("^\d+$")
If Not reg.IsMatch(input) Then
Console.WriteLine("input with invalide charactor")
Return -1
End If
Dim c As Char
Dim results As Integer = 0
For Each c In input.ToCharArray()
results = results * 10
results = results + Integer.Parse(c)
Next
Return results
End Function
Dim reg As Regex = New Regex("^\d+$")
If Not reg.IsMatch(input) Then
Console.WriteLine("input with invalide charactor")
Return -1
End If
Dim c As Char
Dim results As Integer = 0
For Each c In input.ToCharArray()
results = results * 10
results = results + Integer.Parse(c)
Next
Return results
End Function