Quick count list items in a string separated by commas

JGalletta

Windows 7 Access 2010
Local time
Today, 11:05
Joined
Feb 9, 2012
Messages
149
Guys,

Can someone post code for counting commas/specific chars in a string?

i.e.

String = " A,B,C,D "

CountCommas(String) would return 3..

?

My brain is beat for the day..
 
One way:

?Len(" A,B,C,D ")-Len(replace(" A,B,C,D ",",",""))
3
 
That's creative. I like that. Thanks.
 
No problem. That's quick and dirty. You could also create a function to step through the characters, or use the Split() function.
 

Users who are viewing this thread

Back
Top Bottom