internal static string ChangeCase(string text, TextCaseMode textCase, CultureInfo culture, bool capitalizeAfterNonAplhaNumericChars) { switch (textCase) { default: case TextCaseMode.None: return(text); case TextCaseMode.CapitalizeEachWord: return(Capitalize(text, culture, capitalizeAfterNonAplhaNumericChars)); case TextCaseMode.lowercase: return(ToLowercase(text, culture)); case TextCaseMode.UPPERCASE: return(ToUppercase(text, culture)); } }
public static string TrimText(string text, bool replaceAllBlanks, TextCaseMode textCase) { if (!String.IsNullOrEmpty(text)) { if (replaceAllBlanks) { text = text.Replace(" ", String.Empty); } else { text = text.Trim(); } if (textCase != TextCaseMode.None) { text = ChangeCase(text, textCase); } } return(text); }
/// <summary> /// Trims and changes casing of the given text. /// </summary> /// <param name="text"></param> /// <param name="textCase"></param> /// <param name="culture"></param> /// <returns></returns> public static string ChangeCase(string text, TextCaseMode textCase, CultureInfo culture) { return(TextCase.ChangeCase(text, textCase, culture, false)); }