Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find "R" (not "r") in string

Status
Not open for further replies.

fmientjes

Programmer
Mar 27, 2002
55
NL
I want to search a string for the "R" only, (so lowercase ("r") is not valid).

So I hoped the Instr function would do the trick, but it doesn't. There is no difference between R and r.
And I can not search voor the ascii value (Asc("R")=82); I cannot get the instr to work with that.

Can anyone help me out?

Thanks,
Frans

 
Thanks, it give me hint to make the follwing function:
Public Function CheckCombinatie(strCombinatie As String, Optional strReferentie As String) As String


Dim i As Integer
Dim iAantalLetters As Integer
Dim ascCombinatie As Integer

ascCombinatie = Asc(strCombinatie)
iAantalLetters = Len(strReferentie)
CheckCombinatie = "Nee"

If IsEmpty(Trim(strReferentie)) = True Then
Exit Function
End If

For i = 1 To iAantalLetters
If Mid(strReferentie, i, 1) = strCombinatie Then
If Asc(Mid(strReferentie, i, 1)) = ascCombinatie Then 'Combinatie gevonden (case sensitive)
'Found it!
End If
End If
Next i


End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top