/// <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 EscapeCommon(char c, IEscapeProvider d) { String r; if (d.GetCommon().TryGetValue(c, out r)) { return(r); } return(EscapeUnicode(c, d)); }
/// <summary> /// /// </summary> /// <param name="str"></param> /// <param name="type"></param> /// <returns></returns> public static bool IsLiteral(this String str, EscapingType type) { IEscapeProvider d = EscapingDataFactory.Get(type); if (d.GetFirst().ContainsKey(str[0])) { return(false); } foreach (char c in str) { if (d.GetCommon().ContainsKey(c)) { return(false); } } return(true); }
private static String EscapeCommon(char c, IEscapeProvider d) { String r; if (d.GetCommon().TryGetValue(c, out r)) return r; return EscapeUnicode(c, d); }