Use Char.IsPunctuation and Char.IsWhiteSpace to split words
Module Example
Public Sub Main()
Dim s1 As String = "this is a test."
Dim nWords As Integer = 0
s1 = s1.Trim()
For ctr As Integer = 0 To s1.Length - 1
If Char.IsPunctuation(s1(ctr)) Or Char.IsWhiteSpace(s1(ctr))
nWords += 1
End If
Next
Console.WriteLine("The sentence{2} {0}{2}has {1} words.",s1, nWords, vbCrLf)
End Sub
End Module
Related examples in the same category