Results 1 to 2 of 2

Thread: ok! word counter2

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    Laguna Niguel, CA, USA
    Posts
    2

    Post

    What is the code to count the total words and total letters from textbox1 then listing the number of times a particular word is displayed in listbox1? Now the totals must be displayed in some other box separate from the listbox. A command button (we'll call it "parse")will execute the whole action when clicked on.
    thanks

  2. #2
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    get the total number of characters use
    Len{string as string)
    to get number of words do this:
    [code]
    Dim CountWords As Integer
    Dim NumOfWordsStr As String
    NumOfWordsStr = Text1.Text
    Do
    CountWords = CountWords + 1
    NumOfWordsStr = Mid$(NumOfWordsStr, InStr(NumOfWordsStr, " ") + 1, Len(Text1.Text))
    Loop Until InStr(NumOfWordsStr, " ") = 0
    Text2.Text = CountWords + 1
    [code]
    You may need a little editing if you want to include enters and other stuff but this is the basics about the parse you could find an enter or space and find each word and see if it's in there again like the space check above. Hope this helps!

    ------------------
    DiGiTaIErRoR

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