//------------------------------------------------------------------------------
public static string ToProperCase(this string text)
{
string result = "";
char apos = (char)39;
for (int i = 0; i < text.Length; i++)
{
string s = text[i].ToString();
if (i == 0 || (!char.IsLetter(text[i - 1]) & text[i-1] != apos))
result += s.ToUpper();
else
result += s;
}
return result;
}
//------------------------------------------------------------------------------
/// <summary>
/// Takes a Proper-Cased variable name and adds a space before each
/// capital letter.
/// </summary>
public static string AddSpaces(this string text)
{
string result = "";
for (int i = 0; i < text.Length; i++)
{
if (i > 0 && char.IsUpper(text[i]))
result += " ";
result += text.Substring(i, 1);
}
return result;
}