asp.net简繁体转换

时间:2021-06-29 16:24:45

简繁体转换
添加Microsoft.VisualBasic.dll引用

//简转繁
string str= Microsoft.VisualBasic.Strings.StrConv("民生银行", Microsoft.VisualBasic.VbStrConv.TraditionalChinese,new System.Globalization.CultureInfo("zh-cn").LCID);
//繁转简
string str1 = Microsoft.VisualBasic.Strings.StrConv(str, Microsoft.VisualBasic.VbStrConv.SimplifiedChinese, new System.Globalization.CultureInfo("zh-cn").LCID);

//简转繁
str = Microsoft.VisualBasic.Strings.StrConv("民生银行", Microsoft.VisualBasic.VbStrConv.TraditionalChinese, 0);
//繁转简
str1 = Microsoft.VisualBasic.Strings.StrConv(str, Microsoft.VisualBasic.VbStrConv.SimplifiedChinese, 0);

//简转繁
str = Microsoft.VisualBasic.Strings.StrConv("民生银行", Microsoft.VisualBasic.VbStrConv.TraditionalChinese);
//繁转简
str1 = Microsoft.VisualBasic.Strings.StrConv(str, Microsoft.VisualBasic.VbStrConv.SimplifiedChinese);

//转换为小写字符的字符串
str = Microsoft.VisualBasic.Strings.StrConv("民生银行", Microsoft.VisualBasic.VbStrConv.Lowercase);
//转换为大写字符的字符串
str1 = Microsoft.VisualBasic.Strings.StrConv(str, Microsoft.VisualBasic.VbStrConv.Uppercase);

//将窄 (半角) 中为宽 (全角) 字符的字符串的字符转换
Microsoft.VisualBasic.Strings.StrConv(",", Microsoft.VisualBasic.VbStrConv.Wide);
//将转换为窄 (半角) 字符的字符串中的宽 (全角) 字符
Microsoft.VisualBasic.Strings.StrConv(",", Microsoft.VisualBasic.VbStrConv.Narrow);