private static String UnescapeEntity(this String s, IEscapeProvider d) { char r; if (d.GetUnescape().TryGetValue(s, out r)) { return(r.ToString()); } return(null); }
private static String CheckSuffix(String str, int start, int end, IEscapeProvider d) { String s; // the length of escaping code not constant so check all variants foreach (int j in d.GetUnescape().KeysLength) { if (j > end - start + 1) { continue; } s = str.Substring(end - j + 1, j); s = UnescapeEntity(s, d); if (s != null) { return(str.Substring(start, end - start - j + 1) + s); } } // check unicode if (d.GetUnicodePattern() == null) { return(null); } int p = d.GetUnicodePattern().Length + 3; if (p > end - start + 1) { return(null); } s = str.Substring(end - p + 1, p); s = UnescapeUnicode(s, d); if (s != null) { return(str.Substring(start, end - start - p + 1) + s); } return(null); }
private static String UnescapeEntity(this String s, IEscapeProvider d) { char r; if (d.GetUnescape().TryGetValue(s, out r)) return r.ToString(); return null; }
private static String CheckSuffix(String str, int start, int end, IEscapeProvider d) { String s; // the length of escaping code not constant so check all variants foreach (int j in d.GetUnescape().KeysLength) { if (j > end - start + 1) continue; s = str.Substring(end - j + 1, j); s = UnescapeEntity(s, d); if (s != null) return str.Substring(start, end - start - j + 1) + s; } // check unicode if (d.GetUnicodePattern() == null) return null; int p = d.GetUnicodePattern().Length + 3; if (p > end - start + 1) return null; s = str.Substring(end - p + 1, p); s = UnescapeUnicode(s, d); if (s != null) return str.Substring(start, end - start - p + 1) + s; return null; }