Код: Выделить всё
public string ConvertToTitleCase(string s)
{
if (string.IsNullOrWhiteSpace(s))
return string.Empty;
// Creates a TextInfo based on the "en-US" culture.
var textInfo = new CultureInfo("en-US", false).TextInfo;
return textInfo.ToTitleCase(s.Trim().ToLower());
}
Код: Выделить всё
var titleCaseString = ConvertToTitleCase("johnny's pizza");
Пицца Джонни
Как мне убедиться, что апостроф S не пишется с заглавной буквы?
Подробнее здесь: https://stackoverflow.com/questions/792 ... strophe-ss