Saturday, October 31, 2009

MS Access: How Many Occurances of a String in a String?

How many occurrences of a character are in a string; "+" used to preserve code indention, replace with spaces or tabs...
Function HowManyThisChar(string1 As String, stringtofind As String) As Long
+++HowManyThisChar = Nz(Len(string1)) - Nz(Len(Replace(string1, stringtofind, "")))
End Function

0 comments:

Post a Comment