Results 1 to 3 of 3

Thread: Lost in beginning...trying to count.

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 1999
    Posts
    3

    Post

    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.

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Posts
    82

    Post

    Hi,


    Try using the Len(String x) function. It returns the length of the string.

    HTH,

    Preeti

  3. #3
    Lively Member
    Join Date
    Jan 1999
    Posts
    82

    Post

    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
  •  



Click Here to Expand Forum to Full Width