Well, this one comes from after a discussion from one of threads on CodeProject. The following snippet shows how to toggle string casing in .NET:
public string ToggleCase(string input)
{
string result = string.Empty;
char[] inputArray = input.ToCharArray();
foreach (char c in inputArray)
{
if (char.IsLower(c))
result += Char.ToUpper(c);
else
result += Char.ToLower(c);
}
return result;
}
Be First to Comment