Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function FindNthChar(str As String, ch As String, n As Integer) As Integer
- Dim pos As Integer
- Dim i As Integer
- Dim cnt As Integer
- pos = 0
- cnt = 0
- For i = 1 To Len(str)
- If Mid(str, i, 1) = ch Then
- cnt = cnt + 1
- If cnt = n Then
- pos = i
- Exit For
- End If
- End If
- Next i
- FindNthChar = pos
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement