I have the following code which will convert a string to TitleCase.
I would like to create an exception to this, so that if the string entered, finds the exact characters in sequence, it will ignore it and proceed to convert the rest of the string. eg. if part of the string contains: ABC I want to ignore this as a rule and proceed to convert the rest of the string in TitleCase:
public string ConvertToTitleCase(string input)
{
char[] chars = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(input.ToLower()).ToCharArray();
for (int i = 0; i + 1 < chars.Length; i++)
{
if ((chars[i].Equals('\'')) ||
(chars[i].Equals('-')))
{
chars[i + 1] = Char.ToUpper(chars[i + 1]);
}
}
return new string(chars);
}
Any ideas?
This is all you need