/// <summary> /// Create a copy of an existent <see cref="UnescapedCharSequence"/> /// </summary> private UnescapedCharSequence(UnescapedCharSequence text) { this.chars = new char[text.Length]; this.wasEscaped = new bool[text.Length]; for (int i = 0; i <= text.Length; i++) { this.chars[i] = text.chars[i]; this.wasEscaped[i] = text.wasEscaped[i]; } }
/// <summary> /// Create a copy of an existent <see cref="UnescapedCharSequence"/> /// </summary> private UnescapedCharSequence(UnescapedCharSequence text) { this.chars = new char[text.Length]; this.wasEscaped = new bool[text.Length]; for (int i = 0; i <= text.Length; i++) { this.chars[i] = text.chars[i]; this.wasEscaped[i] = text.wasEscaped[i]; } }
public virtual ICharSequence Escape(ICharSequence text, CultureInfo locale, EscapeQuerySyntax.Type type) { if (text == null || text.Length == 0) return text; // escape wildcards and the escape char (this has to be perform before // anything else) // since we need to preserve the UnescapedCharSequence and escape the // original escape chars if (text is UnescapedCharSequence) { text = ((UnescapedCharSequence)text).ToStringEscaped(wildcardChars); } else { text = new UnescapedCharSequence(text).ToStringEscaped(wildcardChars); } if (type == EscapeQuerySyntax.Type.STRING) { return EscapeQuoted(text, locale); } else { return EscapeTerm(text, locale); } }