Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
using System;
using System.Text;
class Program
{
static void Main()
{
string st = "Привет, мир!";
Console.WriteLine(foo(st));
}
static string foo(string input)
{
StringBuilder sb = new StringBuilder();
for(int i = 0; i < input.Length; i += Char.IsSurrogatePair(input, i) ? 2 : 1)
{
int index = Char.ConvertToUtf32(input, i);
sb.Append(@"\u" + index.ToString("x4"));
}
return sb.ToString();
}
}
if(Char.IsSurrogatePair(input, i))
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question