本文整理匯總了C#中System.Globalization.TextInfo.ToUpper方法的典型用法代碼示例。如果您正苦於以下問題:C# TextInfo.ToUpper方法的具體用法?C# TextInfo.ToUpper怎麽用?C# TextInfo.ToUpper使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Globalization.TextInfo
的用法示例。
在下文中一共展示了TextInfo.ToUpper方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DoFirstLetterCase
private string DoFirstLetterCase(NamePart name, bool upper, TextInfo textInfo)
{
string nameValue = name;
if (string.IsNullOrEmpty(nameValue))
{
return nameValue;
}
char c = nameValue[0];
if (upper)
{
c = textInfo.ToUpper(c);
}
else
{
c = textInfo.ToLower(c);
}
if (nameValue.Length > 1)
{
nameValue = c.ToString() + nameValue.Substring(1);
}
else
{
nameValue = c.ToString();
}
return nameValue;
}
示例2: GetCaseChange
private static Func<string, string> GetCaseChange(TextInfo info, string text)
{
if (info.ToLower(text) == text) return (txt) => info.ToTitleCase(txt);
else if (info.ToUpper(text) == text) return (txt) => info.ToLower(txt);
else return (txt) => info.ToUpper(txt);
}
示例3: DoFirstWordCasing
private string DoFirstWordCasing(NamePart name, NameGeneratorCasingOption casing, TextInfo textInfo)
{
if (name.ExplicitCasing) return name;
switch (casing)
{
case NameGeneratorCasingOption.Camel:
return TestHasAdjacentUpperCase(name) ? (string)name : DoFirstLetterCase(name, false, textInfo);
case NameGeneratorCasingOption.Pascal:
return TestHasAdjacentUpperCase(name) ? (string)name : DoFirstLetterCase(name, true, textInfo);
case NameGeneratorCasingOption.Lower:
return TestHasAdjacentUpperCase(name) ? (string)name : textInfo.ToLower(name);
case NameGeneratorCasingOption.Upper:
return textInfo.ToUpper(name);
}
return null;
}