Replace Escaped Unicode Character - CSharp System

CSharp examples for System:String Replace

Description

Replace Escaped Unicode Character

Demo Code


using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using System;//from  ww  w . j  a  va  2 s.c  o  m

public class Main{
        public static string ReplaceEscapedUnicodeCharacter(string input)
        {
            return Regex.Replace(input, @"(?:\\|%)[uU]([0-9A-Fa-f]{4})",
                match => ((char)Int32.Parse(match.Value.Substring(2), NumberStyles.HexNumber)).ToString());
        }
}

Related Tutorials