Here you can find the source of quoteIdentifier(String s)
Parameter | Description |
---|---|
s | the text |
public static String quoteIdentifier(String s)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w ww. j av a2 s . co m*/ * Enclose a string with double quotes. A double quote inside the string is * escaped using a double quote. * * @param s the text * @return the double quoted text */ public static String quoteIdentifier(String s) { int length = s.length(); StringBuilder buff = new StringBuilder(length + 2); buff.append('\"'); for (int i = 0; i < length; i++) { char c = s.charAt(i); if (c == '"') { buff.append(c); } buff.append(c); } return buff.append('\"').toString(); } }