' 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
Imports System.Text.RegularExpressions

Namespace E
    Public Class MainClass
        Public Shared Function ToCapital(ByVal s As String) As String
            Dim res As String = s.Substring(0, 1).ToUpper + s.Substring(1).ToLower
            Dim mc As MatchCollection = Regex.Matches(s, " [a-z]")
            Dim i As Integer
            For i = 0 To mc.Count-1
                res = res.Replace(mc(i).Groups(0).ToString, mc(i).Groups(0).ToString.ToUpper)
            Next
            Return res
        End Function

        Public Shared Sub Main(ByVal args As String())
            Console.WriteLine(ToCapital("dan mikkelsen"))
        End Sub
    End Class 
End Namespace
