public static String escape(String s) {StringBuilder sb = new StringBuilder();for (int i = 0; i < s.length(); i++) {char c = s.charAt(i);if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')'|| c == ':' || c == '^' || c == '[' || c == ']' || c == '\"'|| c == '{' || c == '}' || c == '~' || c == '*' || c == '?'|| c == '|' || c == '&' || c == '/') {sb.append('\\');}sb.append(c);}return sb.toString();}

public static String escape ( String s ) { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')' || c == ':' || c == '^' || c == '[' || c == ']' || c == '\"' || c == '{' || c == '}' || c == '~' || c == '*' || c == '?' || c == '|' || c == '&' || c == '/' ) { sb . append ( '\\' ) ; } sb . append ( c ) ; } return sb . toString ( ) ; }
public static string Escape(string s){StringBuilder sb = new StringBuilder();for (int i = 0; i < s.Length; i++){char c = s[i];if (c == '\\' || c == '+' || c == '-' || c == '!' || c == '(' || c == ')'|| c == ':' || c == '^' || c == '[' || c == ']' || c == '\"'|| c == '{' || c == '}' || c == '~' || c == '*' || c == '?'|| c == '|' || c == '&' || c == '/'){sb.Append('\\');}sb.Append(c);}return sb.ToString();}
