本文整理汇总了C#中System.Globalization.TextInfo.ToLower方法的典型用法代码示例。如果您正苦于以下问题:C# TextInfo.ToLower方法的具体用法?C# TextInfo.ToLower怎么用?C# TextInfo.ToLower使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Globalization.TextInfo
的用法示例。
在下文中一共展示了TextInfo.ToLower方法的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;
}