|
-
Jul 17th, 1999, 02:58 PM
#1
Thread Starter
New Member
I am a beginner...trying to get information on how to count words,sentences etc. in text being entered. There are many buggy problems with it. Any advice is already appreciated! Even where to look it up myself.
-
Jul 18th, 1999, 05:29 PM
#2
Lively Member
Hi,
Try using the Len(String x) function. It returns the length of the string.
HTH,
Preeti
-
Jul 18th, 1999, 05:51 PM
#3
Lively Member
Hi,
I reread your question, and I don't think that I answered it.
To count words we will assume that each word is seperated by a space so...
Private Function WordCount(Sentence As String) As Integer
Dim iPos As String 'Position of space in string
Dim TotalWords As Integer 'Number of words in string
Dim EOS As Boolean 'End Of String Flag
Dim iStart As Integer 'Starting position to search
iStart = 1 'Initialize to 1
Do Until EOS
iPos = InStr(Trim(Mid(Sentence, iStart)), " ")
TotalWords = TotalWords + 1
If iPos = 0 Then 'If no spaces were found
EOS = True
Else
iStart = iStart + iPos 'Start searching after the space
End If
Loop
WordCount = TotalWords
End Function
HTH,
Preeti
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|