app/src/main/java/org/andstatus/app/data/MyQuery.java
/**
     * @return two single quotes for empty/null strings (Use single quotes!)
     */
@return two single quotes for empty/null strings (Use single quotes!)
@return two single quotes for empty / null strings ( Use single quotes! )
public static String quoteIfNotQuoted(String original) {
        if (StringUtil.isEmpty(original)) {
            return "\'\'";
        }
        String quoted = original.trim();
        int firstQuoteIndex = quoted.indexOf('\'');
        if (firstQuoteIndex < 0) {
            return '\'' + quoted + '\'';
        }
        int lastQuoteIndex = quoted.lastIndexOf('\'');
        if (firstQuoteIndex == 0 && lastQuoteIndex == quoted.length()-1) {
            quoted = quoted.substring(1, lastQuoteIndex);
        }
        quoted = quoted.replace("'", "''");
        quoted = '\'' + quoted + '\'';
        return quoted;
    }
public static String quoteIfNotQuoted ( String original ) { if ( StringUtil . isEmpty ( original ) ) { return "\'\'" ; } String quoted = original . trim ( ) ; int firstQuoteIndex = quoted . indexOf ( '\'' ) ; if ( firstQuoteIndex < 0 ) { return '\'' + quoted + '\'' ; } int lastQuoteIndex = quoted . lastIndexOf ( '\'' ) ; if ( firstQuoteIndex == 0 && lastQuoteIndex == quoted . length ( ) - 1 ) { quoted = quoted . substring ( 1 , lastQuoteIndex ) ; } quoted = quoted . replace ( "'" , "''" ) ; quoted = '\'' + quoted + '\'' ; return quoted ; }
@return two single quotes for empty/null strings (Use single quotes!)
@return two single quotes for empty / null strings ( Use single quotes! )
// Already quoted, search quotes inside