- // ### There must be a better way ...
- if (quotedTerm.indexOf('"') != -1 ||
- quotedTerm.indexOf(' ') != -1 ||
- quotedTerm.indexOf('\t') != -1 ||
- quotedTerm.indexOf('=') != -1 ||
- quotedTerm.indexOf('<') != -1 ||
- quotedTerm.indexOf('>') != -1 ||
- quotedTerm.indexOf('/') != -1 ||
- quotedTerm.indexOf('(') != -1 ||
- quotedTerm.indexOf(')') != -1) {
- quotedTerm = '"' + quotedTerm + '"';
+ return res;
+ }
+
+ static String maybeQuote(String str) {
+ // There _must_ be a better way to make this test ...
+ if (str.length() == 0 ||
+ str.indexOf('"') != -1 ||
+ str.indexOf(' ') != -1 ||
+ str.indexOf('\t') != -1 ||
+ str.indexOf('=') != -1 ||
+ str.indexOf('<') != -1 ||
+ str.indexOf('>') != -1 ||
+ str.indexOf('/') != -1 ||
+ str.indexOf('(') != -1 ||
+ str.indexOf(')') != -1) {
+ str = '"' + Utils.replaceString(str, "\"", "\\\"") + '"';