Return to Snippet

Revision: 50225
at August 16, 2011 12:35 by pillow86


Initial Code
public static string UnicodeToCharacter(string inStr)
{
	string result = inStr;
	if (Regex.Match(inStr, @".*\\u.*").Success)
	{
		Regex rx = new Regex(@"\\[uU]([0-9A-F]{4})");
		result = rx.Replace(result, delegate(Match match) { return ((char)Int32.Parse(match.Value.Substring(2), NumberStyles.HexNumber)).ToString(); });
	}
	return result;
}

Initial URL


Initial Description
Convert "\u6211" to "我"

Initial Title
Convert Unicode Escape Sequence to Character

Initial Tags


Initial Language
C#