[dba-VB] Count of specific character

Foote, Chris Chris.Foote at uk.thalesgroup.com
Wed Jul 25 05:38:29 CDT 2007

Morning John!

I do not know of any specific special function to do this, but there's a
trick I use in Excel using the SUBSTITUTE function. I use LEN to get the
number of characters in the original string. Use SUBSTITUTE to replace the
character I need to count with "" (nothing). LEN the results and subtract
this from the original LEN.

Hope this helps!

Chris Foote

> -----Original Message-----
> From: dba-vb-bounces at databaseadvisors.com
> [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of jwcolby
> Sent: Tuesday, July 24, 2007 8:33 PM
> To: dba-vb at databaseadvisors.com
> Subject: [dba-VB] Count of specific character
> Is there any single function that will return a count of a specific
> character in a string?
> I have a situation where (apparently) the header of a CSV 
> file has the same
> field name twice.  I am trying to determine what is going on, 
> so I want to
> count the field separator characters in the header and the 
> first line of
> real data to see if there are more fields in the header than 
> in the data or
> if something else is going on.
> John W. Colby
> Colby Consulting
> www.ColbyConsulting.com 
> _______________________________________________
> dba-VB mailing list
> dba-VB at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-vb
> http://www.databaseadvisors.com

More information about the dba-VB mailing list