Imports System.Text
'全型轉半型 Public Function ToNchr(ByRef data As String) As String Dim sb As New StringBuilder Dim ascii As Integer = 0
For Each c As Char In data.Replace("〔", "[").Replace("〕", "]").Replace("'", "'").ToCharArray() ascii = System.Convert.ToInt32(c) If ascii = 12288 Then sb.Append(System.Convert.ToChar(32)) Else If ascii > 65280 And ascii < 65375 Then sb.Append(System.Convert.ToChar(ascii - 65248)) Else sb.Append(System.Convert.ToChar(ascii)) End If End If Next
Return sb.ToString End Function |
全站熱搜