方法: https://docs.microsoft.com/zh-tw/dotnet/api/microsoft.visualbasic.strings.strconv?view=net-5.0
加入參考→組件: 勾選 Microsoft.VisualBasic
輸入:
string address1 = "100台北市中正區重慶南路一段122號";
string address2 = "100台北市中正區重慶南路一段122號";
ViewBag.全形 = Strings.StrConv(address1, VbStrConv.Wide, 0);
ViewBag.半形 = Strings.StrConv(address2, VbStrConv.Narrow, 0);
ViewBag.簡體 = Strings.StrConv(address1, VbStrConv.SimplifiedChinese, 2052);
輸出: