Dear All,

Would anyone to tell me how to count how many character in a string.

Thank you very much for any reply.

Ah Wa

Re: Count number of character by Eric

Eric
Mon Aug 09 04:26:17 CDT 2004

Hello, Ah!
You wrote on Mon, 9 Aug 2004 17:22:50 +0800:

AW> Would anyone to tell me how to count how many character in a string.

If you want to count all chrs, then you can use LEN().
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Re: Count number of character by Gerben

Gerben
Mon Aug 09 04:25:51 CDT 2004

? LEN(STRING)

Gerben Kessen

"Ah Wa" <cpcpwy@ahwa.net> wrote in message
news:%238dYTJffEHA.3016@tk2msftngp13.phx.gbl...
> Dear All,
>
> Would anyone to tell me how to count how many character in a string.
>
> Thank you very much for any reply.
>
> Ah Wa
>
>



Re: Count number of character by mspratt

mspratt
Mon Aug 09 10:35:22 CDT 2004

Or, without spaces.
? LEN(CHRTRAN(cString, " ", ""))

Regards,

Mike

On Mon, 9 Aug 2004 17:22:50 +0800, "Ah Wa" <cpcpwy@ahwa.net> wrote:

>Dear All,
>
>Would anyone to tell me how to count how many character in a string.
>
>Thank you very much for any reply.
>
>Ah Wa
>


Re: Count number of character by Fred

Fred
Mon Aug 09 11:11:10 CDT 2004

The others have told you how to get the total length of the string, but if
you need to know how many of a specific character or substring, you can use
OCCURS():

nAB = OCCURS("ab","abacab") && 2 occurences of "ab"

Fred
Microsoft Visual FoxPro MVP


"Ah Wa" <cpcpwy@ahwa.net> wrote in message
news:%238dYTJffEHA.3016@tk2msftngp13.phx.gbl...
> Dear All,
>
> Would anyone to tell me how to count how many character in a string.
>
> Thank you very much for any reply.
>
> Ah Wa
>
>



Re: Count number of character by Neil

Neil
Mon Aug 09 14:27:58 CDT 2004

Also, be careful when applying this to a field. If you have a field Myfield,
char, 30, with value "abcde".

? LEN(Myfield) will always return 30.
? LEN(ALLTRIM(Myfield)) will return 5.


"Ah Wa" <cpcpwy@ahwa.net> wrote in message
news:%238dYTJffEHA.3016@tk2msftngp13.phx.gbl...
> Dear All,
>
> Would anyone to tell me how to count how many character in a string.
>
> Thank you very much for any reply.
>
> Ah Wa
>
>