/// <summary> /// /// </summary> /// <param name="c"></param> /// <param name="type"></param> /// <param name="first"></param> /// <returns></returns> public static bool IsLiteral(this char c, EscapingType type, bool first = false) { IEscapeProvider d = EscapingDataFactory.Get(type); return(!(first && d.GetFirst().ContainsKey(c) || d.GetCommon().ContainsKey(c) || d.NeedEscapeUnicode(c))); }
private static String EscapeUnicode(char c, IEscapeProvider d) { // escaping not defined if (d.GetUnicodePattern() == null) { return(c.ToString()); } if (!d.NeedEscapeUnicode(c)) { return(c.ToString()); } return(d.GetUnicodePattern().Replace(" ", ((int)c).ToString("X4"))); }
private static String EscapeUnicode(char c, IEscapeProvider d) { // escaping not defined if (d.GetUnicodePattern() == null) return c.ToString(); if (!d.NeedEscapeUnicode(c)) return c.ToString(); return d.GetUnicodePattern().Replace(" ", ((int)c).ToString("X4")); }