C#将首字母自动转换大写
///上一篇PinYin设置的枚举
[System.FlagsAttribute]
public enum PinYinOptions
{
None = 0,
FirstLetterOnly = 1, //只转换拼音首字母,默认转换全部
TranslateUnknowWordToInterrogation = 1 << 1, //转换未知汉字为问号,默认不转换
EnableUnicodeLetter = 1 << 2,//保留非字母、非数字字符,默认不保留
}
//转换需要用空格区分
CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
TextInfo text = cultureInfo.TextInfo;
RandName = text.ToTitleCase(RandName);

浙公网安备 33010602011771号