在vs.net 2003中打开[Tools]-[macros]-[macros explorer] 然后将下面的代码copy-paste 进去 代开你要转换的cs文件,在mymacros form中单击dubug就可以了
Imports EnvDTE
Imports System.Globalization
Imports System.Text.RegularExpressions
Imports System.Diagnostics
Public Module Birdshome
Sub Unicode2Character()
Dim doc As Document = DTE.ActiveDocument
Dim docText As TextDocument = doc.Object
Dim selText As TextSelection = docText.Selection()
selText.SelectAll()
Dim text As String = selText.Text
Dim iLength As Integer
Do
iLength = text.Length
Dim m As Match
Dim strPattern As String = "(?<code>\\u[A-F0-9]{4})"
m = Regex.Match(text, strPattern, RegexOptions.IgnoreCase)
If m.Success Then
Dim strValue As String
strValue = m.Groups("code").Value
text = text.Replace(strValue, "")
Dim int As Integer
int = System.Int32.Parse(strValue.Substring(, ), NumberStyles.HexNumber)
Dim ch As Char = ChrW(int)
docText.ReplacePattern(strValue, ch)
Else
Exit Do
End If
If Not text.Length < iLength Then
Exit Do
End If
Loop
selText.StartOfDocument()
End Sub
End Module
一切就都搞定了 希望能给大家提供一些帮助