Computing.Net > Forums > Web Development > What to use in VBScript to count

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

What to use in VBScript to count

Reply to Message Icon

Name: antgaudi
Date: March 18, 2009 at 23:39:19 Pacific
OS: Windows XP
CPU/Ram: 1.5 GHz / 495 MB
Subcategory: General
Comment:

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!"
document.write(Mid(txt,"i"))
document.write(Len(txt))

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



Sponsored Link
Ads by Google

Response Number 1
Name: Radix-64
Date: March 20, 2009 at 15:42:48 Pacific
Reply:

Hi, have you tried using the split and ubound functions? Maybe something like:

<%
Dim textstring, wipstring, numberoftimes
textString ="The brown fox jumped quickly over a fence"
wipstring = Split(textstring, "a")
numberoftimes = UBound(wipstring)
Response.write "The count is " & numberoftimes & " ."
%>


0

Response Number 2
Name: antgaudi
Date: March 20, 2009 at 23:02:27 Pacific
Reply:

Wow, you're awesome. Thanks! :)


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: What to use in VBScript to count

Best country in which to host mirror sites www.computing.net/answers/webdevel/best-country-in-which-to-host-mirror-sites/4111.html

How to hyperlink in CMS www.computing.net/answers/webdevel/how-to-hyperlink-in-cms/4281.html

corrupt text on uploading to server www.computing.net/answers/webdevel/corrupt-text-on-uploading-to-server/2078.html