Count of Character in Text String

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to determine the number of times a given character exists in a given text string. For example, how many spaces are in a formal name? I can use InStr() and then use InStr() again, using the results of the first search plus one as the start position for the nest search. I would need to keep doing this until the result is zero

But I'm hoping there is already a function out there I can use that can tell me CountInStr("Ella Fitzgerald", "l") = 3. Is there anything like that?
 
Marty2of5 said:
I need to determine the number of times a given character exists in a
given text string. For example, how many spaces are in a formal name?
I can use InStr() and then use InStr() again, using the results of
the first search plus one as the start position for the nest search.
I would need to keep doing this until the result is zero.

But I'm hoping there is already a function out there I can use that
can tell me CountInStr("Ella Fitzgerald", "l") = 3. Is there anything
like that?

It may not be the most effiicient method possible, but if you're running
Access 2000 or later you can use UBound and Split in combination to do
this:

?Ubound(Split("Ella Fitzgerald", "l"))
3
 
Back
Top