VBA. How to find position of first digit in string

前端 未结 6 1252
陌清茗
陌清茗 2020-12-31 08:47

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

6条回答
  •  不知归路
    2020-12-31 09:25

    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
    

提交回复
热议问题