Web Hosting, Design, & Coding forum

General discussion

How to count # of times a letter appears in VBScript

by antgaudi / March 18, 2009 4:43 PM PDT

What should I use in VBScript to count the # of times a letter appears in a string?
I've tried:

dim txt
txt="This is a beautiful day!"

The code didn't even work...please help. Thanks.

Discussion is locked
You are posting a reply to: How to count # of times a letter appears in VBScript
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: How to count # of times a letter appears in VBScript
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
Well not in VB but Java
by FrankQC / April 5, 2009 10:59 AM PDT

Do some research on like...


This might not be useful for you but you'll be using something similar.

.length checks for the characters in the String

Collapse -
May I ask where this requirement comes from.
by Kees Bakker / April 6, 2009 2:45 AM PDT

Moreover, the requirement isn't very clear.
- Is T and t the same letter?
- Is a space a letter?
- Is an exclamation mark a letter?


Collapse -
I think he meant...
by FrankQC / April 6, 2009 3:00 AM PDT

A character.


0 1 2 3 4 5 6 7 8 9

a to z

everything is considered a character in the string

Popular Forums
Computer Newbies 10,686 discussions
Computer Help 54,365 discussions
Laptops 21,181 discussions
Networking & Wireless 16,313 discussions
Phones 17,137 discussions
Security 31,287 discussions
TVs & Home Theaters 22,101 discussions
Windows 7 8,164 discussions
Windows 10 2,657 discussions


Turn up the volume with our Apple Byte sweeps!

Two lucky winners will take home the coveted smart speaker that lets Siri help you around your connected house. This sweepstake ends Feb. 25, 2018.