using System;
using System.Text.RegularExpressions;
public class RXProperCaseApp {
static void Main(string[] args) {
string s = "the qUEEn wAs in HER parLOr";
s = s.ToLower();
string e = @"\w+|\W+";
string sProper = "";
foreach (Match m in Regex.Matches(s, e)) {
sProper += char.ToUpper(m.Value[0])
+ m.Value.Substring(1, m.Length - 1);
}
Console.WriteLine("ProperCase:\t{0}", sProper);
}
}
|