How 'bout this
Code:
Function CountWords(ByVal theText As String) As Int32
Dim loopCTR, wordCTR As Int32
Dim words() As String
Dim valid As String = "abcdefghijklmnopqrstuvwxyz" 'characters that define word beginning
Dim strip As String = ":;?/.>,<`~!@#$%^&*()-_=+[{}]|\'0123456789" & ControlChars.Quote 'strip this out
valid &= valid.ToUpper 'upper and lower
theText = theText.Trim 'get rid of lead/trail spaces
For loopCTR = 0 To strip.Length - 1 'strip characters out (is strip defined correctly?)
theText = theText.Replace(strip.Substring(loopCTR, 1), " ")
Next
words = theText.Trim.Split(" "c) 'split into an array
For loopCTR = 0 To words.Length - 1
If words(loopCTR) <> "" Then
If valid.IndexOf(words(loopCTR).Substring(0, 1)) <> -1 Then
wordCTR += 1
End If
End If
Next
End Function
I just threw this together, but my gut says strip may need attention.