본문 바로가기

C#

[c#] $#???; 형태의 유니코드를 한글로 변환

유니코드를 한글로 변환하는 코드


string str = "아무";
            
str = System.Web.HttpUtility.HtmlDecode(str).Replace("&#", string.Empty);

string[] arr = str.Split(new string[]{";"}, StringSplitOptions.RemoveEmptyEntries);

StringBuilder sb = new StringBuilder();

foreach (string a in arr)
{
    int i = int.Parse(a);
    sb.Append(char.ConvertFromUtf32(i));
}

Console.WriteLine(sb.ToString());

'C#' 카테고리의 다른 글