Here you can find the source of quote(String entityName)
private static String quote(String entityName)
//package com.java2s; public class Main { public static final char SINGLE_QUOTE = '\''; public static final char ESCAPE_CHAR = '\\'; private static String quote(String entityName) { StringBuilder sb = new StringBuilder(); sb.append("'"); for (int i = 0; i < entityName.length(); i++) { char curChar = entityName.charAt(i); if (curChar == SINGLE_QUOTE || curChar == ESCAPE_CHAR) { sb.append(ESCAPE_CHAR);/*from www . j ava 2 s. com*/ } else { sb.append(curChar); } } sb.append("'"); return sb.toString(); } }