就是把4个看似莫名其妙的字符串换成我们天朝的汉字,我整整搞了一晚上,很郁闷~
不过做后Unicode转汉字,还是成功了~OY
期间多次尝试,或者程序执行报错,或者直接被无视,或者那啥啥啥~
总之这晚上是在看各种文章中,杂乱的度过的\u5341\u4E8C\u5C11猜猜这个的结果。
不得不佩服广大劳动人民的智慧,从最原始的高位,低位的变化,到引用某某类
看得联头晕眼花,最后,稀里糊涂的,也忘记了是在那ctrl+c的一个函数。。。世界清静了~
NND,太神奇了,一下子方法,原来最初的那个也是对的,只是少了一个转换~
哎~突然有种感觉,这夜又荒废了~
最后附上vb.net的例子
Private Function U2CnCode(ByVal str As String) As String
Dim m As Match
Dim r As New Regex("(?
\\u[a-z0-9]{4})", RegexOptions.IgnoreCase)
m = r.Match(str)
While m.Success
Dim strValue As String = m.Result("${code}")
Dim CharNum As Integer = Int32.Parse(strValue.Substring(2, 4), System.Globalization.NumberStyles.HexNumber)
Dim ch As String = String.Format("{0}", DirectCast(ChrW(CharNum), Char))
str = str.Replace(strValue, ch)
m = m.NextMatch()
End While
Return str
End Function


这个应该有在线的工具吧…