C#利用微软自带库进行中文繁体和简体之间的转换的代码
2021-06-10 11:04
标签:ros sim new cli bst 码农 备份 中文繁体 转换 C#利用微软自带库进行中文繁体和简体之间的转换的代码 标签:ros sim new cli bst 码农 备份 中文繁体 转换 原文地址:https://blog.51cto.com/14143192/2369740 protected void Button1_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(txt_value.Text))
{
return;
}
else
{
string value = txt_value.Text.Trim();
string newValue = StringConvert(value, "1");
if (!string.IsNullOrEmpty(newValue))
{
TextArea1.Value = newValue;
}
}
}
protected void Button2_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(txt_value.Text))
{
return;
}
else
{
string value = txt_value.Text.Trim();
string newValue = StringConvert(value, "2");
if (!string.IsNullOrEmpty(newValue))
{
TextArea1.Value = newValue;
}
}
}
#region IString 成员
public string StringConvert(string x, string type)
{
String value = String.Empty;
switch (type)
{
value = Microsoft.VisualBasic.Strings.StrConv(x, Microsoft.VisualBasic.VbStrConv.TraditionalChinese,0);
break;
case "2":
value = Microsoft.VisualBasic.Strings.StrConv(x, Microsoft.VisualBasic.VbStrConv.SimplifiedChinese, 0);
break;
default:
break;
}
return value;
}
#endregion