class Strings {

    public static String quotedIdent(String s, char quote, boolean force) {

        String quoteS = Character.toString(quote);

        if (s.contains(quoteS)){
             s = s.replaceAll( ("[" + quoteS + "]") , quoteS + quoteS );
        }

        if (!force && !NodeToString.isReserved(s) && s.matches("[a-z][_a-z0-9$]*") ) {
            return s;
        }
        else {
            return quote + s + quote;
        }
    }

}