Imports System
Public Class exercise100
Public Shared Function CountSpaces(ByVal text As String) As Integer
Dim countSpaces As Integer = 0
Dim letter As String
For i As Integer = 0 To text.Length - 1
letter = text.Substring(i, 1)
If letter = " " Then countSpaces += 1
Next
Return countSpaces
End Function
Public Shared Sub Main()
Console.WriteLine("""Hello, how are you"" contains {0} spaces", CountSpaces("Hello, how are you"))
End Sub
End Class