Antlr4.Codegen.Target.JavaTarget.EncodeIntAsCharEscape C# (CSharp) Метод

EncodeIntAsCharEscape() публичный Метод

public EncodeIntAsCharEscape ( int v ) : string
v int
Результат string
        public override string EncodeIntAsCharEscape(int v)
        {
            if (v < char.MinValue || v > char.MaxValue)
            {
                throw new ArgumentException(string.Format("Cannot encode the specified value: {0}", v));
            }

            if (v >= 0 && v < targetCharValueEscape.Length && targetCharValueEscape[v] != null)
            {
                return targetCharValueEscape[v];
            }

            if (v >= 0x20 && v < 127 && (!char.IsDigit((char)v) || v == '8' || v == '9'))
            {
                return ((char)v).ToString();
            }

            if (v >= 0 && v <= 127)
            {
                string oct = Convert.ToString(v, 8);
                return "\\" + oct;
            }

            string hex = v.ToString("x4");
            return "\\u" + hex;
        }