' Collection of code snippets by Arne Vajhøj ' posted to eksperten.dk, usenet and other places (2002-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