' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
Imports System

Module Main
    Function CountPeriods(s As String) As Integer
        Dim res as integer = 0
        Dim i As Integer
        For i = 0 To (s.Length - 1)
            If s.Chars(i) = "." Then
                res = res + 1
            End If
        Next
        CountPeriods = res
    End Function

    Sub Main()
        Console.WriteLine(CountPeriods("x"))
        Console.WriteLine(CountPeriods("x.x"))
        Console.WriteLine(CountPeriods("x.x.x"))
        Console.WriteLine(CountPeriods("x.x.x.x"))
    End Sub
End Module
