Given this string: "EMAIL_LOG"
I want to convert it to: EmailLog
I have this code that does do the job:
private static string TitleCaseConvert(string title)
{
CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
TextInfo textInfo = cultureInfo.TextInfo;
title = title.Replace("_", " ").ToLower();
title = textInfo.ToTitleCase(title);
title = title.Replace(" ", "");
return title;
}
I was just wondering if there was a better suggestion to do this conversion or one that was more elegant perhaps?
Thanks.
.TextInfo.ToTitleCase("EMAIL_LOG".ToLower()).Replace("_", "")