code: private static String delimit(String s, char c) {
      int i = s.indexOf(c);
      while (i != -1) {
        if (i == 0 || s.charAt(i - 1) != '\\') {
          s = s.substring(0, i) + '\\' + s.substring(i);
          i = s.indexOf(c, i + 2);
        } else {
          i = s.indexOf(c, i + 1);
        }
      }
      return s;
    }
docs: This quotes a character with a backslash, but doesn't do it
  if the character is already preceded by a backslash.