QUT.Gplex.Parser.CharacterUtilities.InterpretCharacterEscapes C# (CSharp) Method

InterpretCharacterEscapes() public static method

This static method expands characters in a literal string, returning a modified string with character escapes replaced by the character which they denote. This includes characters outside the BMP which return a pair of surrogate characters.
public static InterpretCharacterEscapes ( string source ) : string
source string
return string
        public static string InterpretCharacterEscapes(string source)
        {
            int sLen = source.Length;
            if (sLen == 0)
                return source;
            char[] arr = new char[sLen];
            int sNxt = 0;
            int aNxt = 0;
            char chr = source[sNxt++];
            for (; ; chr = source[sNxt++])
            {
                if (chr != '\\')
                    arr[aNxt++] = chr;
                else
                {
                    int codePoint = EscapedChar(source, ref sNxt);
                    if (codePoint > 0xFFFF)
                    {
                        arr[aNxt++] = CharacterUtilities.HiSurrogate(codePoint);
                        arr[aNxt++] = CharacterUtilities.LoSurrogate(codePoint);
                    }
                    else
                        arr[aNxt++] = (char)codePoint;
                }
                if (sNxt == sLen)
                    return new String(arr, 0, aNxt);
            }
        }