Alex Rivera | Logout

VBA. How to find position of first digit in string

Asked 2010-08-23T13:00:27.737
15

I have string "ololo123". I need get position of first digit - 1. How to set mask of search ?

Edit
Report

1 Answer

2

I actually have that function:

Public Function GetNumericPosition(ByVal s As String) As Integer
    Dim result As Integer
    Dim i As Integer
    Dim ii As Integer

    result = -1
    ii = Len(s)
    For i = 1 To ii
        If IsNumeric(Mid$(s, i, 1)) Then
            result = i
            Exit For
        End If
    Next
    GetNumericPosition = result
End Function
answered 2010-08-23T14:19:46.087

Your Answer