Simple version.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim str As String = "ABC DEF GHIJ KLMNOPQ"
Dim strA() As String = str.Split(" ")
Dim TChrs As Int32
Dim i As Int32
For i = strA.Length - 1 To 0 Step -1
TChrs += strA(i).Length
Next
MsgBox("Number of words = " & strA.Length)
MsgBox("Average Length = " & TChrs / strA.Length)
End Sub
Regards - OHM
Tom E. wrote:
> Hello, I would like to know what the most efficient way is to count
> words in a string and to determine what the average word length is. I
> know this can be done in a array, but is there an easier way using
> VB.Net? Thank you in advance!
Regards - OHM#
(E-Mail Removed)