Search Tools Links Login

Counting number of words in a string


This is a simple and easy way for counting the number of words in a string.

Original Author: Hendry Cahyadi

Code

dim TheString, ArrayTemp, NumberOfWords, Word
TheString = "Hello, How are you today?" 'just a test string
ArrayTemp = split(TheString, " ")
NumberOfWords = UBound(ArrayTemp) + 1
Response.Write "

The string is: " & TheString
Response.Write "

Number of words in that string: " & NumberOfWords
Response.Write "

Here are the words which compose that string: "
for each Word in ArrayTemp
Response.Write "
" & word
next

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 97 times

Categories

ASP/ HTML

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.