Detect chinese character in a string VB.NET
Is there a way to detect a Chinese character in a string which is build like this:
dim test as string = "letters 中國的"
Now I want to substring only the Chinese characters. But my code is database driven, so I can't substring it, because the length is always different. So is there a way I can split the string, from the moment I detect a Chinese character?
I think you can use regexp like in the following example, didn't test and I haven't code using VB.net for years So syntax may be not correct.
Dim m As Match = Regex.Match(value, "[\u4e00-\u9fa5]+", RegexOptions.IgnoreCase) ' If successful, write the group. If (m.Success) Then Dim key As String = m.Groups(1).Value End If