public static String formatString(final boolean format, final CharSequence object) {
		if (object == null) return "null";
		final String space = (format ? "\\n\"+\n\"" : "\\n");
		final StringBuilder result = new StringBuilder("\"");
		int last = -1, next = 0;
		final int size = object.length();
		while (next < size) {
			switch (object.charAt(next)) {
				case '\"':
					result.append(object.subSequence(last + 1, last = next)).append("\\\"");
				break;
				case '\t':
					result.append(object.subSequence(last + 1, last = next)).append("\\t");
				break;
				case '\n':
					result.append(object.subSequence(last + 1, last = next)).append(space);
				break;
				case '\r':
					result.append(object.subSequence(last + 1, last = next)).append("\\r");
				break;
			}
			next++;
		}
		return result.append(object.subSequence(last + 1, size)).append("\"").toString();
	}