[AccessD] Number of a specific characters in a string

John Skolits askolits at ot.com
Mon Jul 24 16:23:31 CDT 2006


Very Clever! Thanks


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com
Sent: Monday, July 24, 2006 5:07 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Number of a specific characters in a string

Don't know of a default function to do this, however, you could make one
with just a few lines in a function:

Function NumOfSpecificChar(strText as String, strCharacter as string) As
Long
Dim strTemp as string
strTemp=Replace(strText,strCharacter,"")
NumOfSpecificChar=(Len(strText)-Len(strTemp))/Len(strCharacter)
End Function

Drew

-----Original Message-----
From: John Skolits [mailto:askolits at ot.com] 
Sent: Monday, July 24, 2006 2:58 PM
To: accessD at databaseadvisors.com
Subject: [AccessD] Number of a specific characters in a string

I'm sure I could write some code for this, but is there a function that
returns the occurrences of a specific character within a string.

 

Ie:

If the string is

strSTRING = " Hello how are you, today"

 

And I put it in a function called NumOfSpecifcChar() where the firsts
argument is the string and the second the string value to search for.

 

integerValue = NumOfSpecifcChar (strSTRING, "o")

 

It would return a '4'

 

 

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list