Java String Quote quoteRemarkSQL(String sql)

Here you can find the source of quoteRemarkSQL(String sql)

Description

In a string, replace block comment marks with /++ ..

License

Open Source License

Parameter

Parameter Description
sql the string

Return

the resulting string

Declaration

public static String quoteRemarkSQL(String sql) 

Method Source Code

//package com.java2s;
/*/*from  w ww  .  j  a v  a2  s  .  c o m*/
 * Copyright 2004-2013 H2 Group. Multiple-Licensed under the H2 License,
 * Version 1.0, and under the Eclipse Public License, Version 1.0
 * (http://h2database.com/html/license.html).
 * Initial Developer: H2 Group
 *
 * Nicolas Fortin, Atelier SIG, IRSTV FR CNRS 24888
 * Support for the operator "&&" as an alias for SPATIAL_INTERSECTS
 */

public class Main {
    /**
     * In a string, replace block comment marks with /++ .. ++/.
     *
     * @param sql the string
     * @return the resulting string
     */
    public static String quoteRemarkSQL(String sql) {
        while (true) {
            int idx = sql.indexOf("*/");
            if (idx < 0) {
                break;
            }
            sql = sql.substring(0, idx) + "++/" + sql.substring(idx + 2);
        }
        while (true) {
            int idx = sql.indexOf("/*");
            if (idx < 0) {
                break;
            }
            sql = sql.substring(0, idx) + "/++" + sql.substring(idx + 2);
        }
        return sql;
    }
}

Related

  1. quotePlainText(final String textContent)
  2. quoteQuery(String query)
  3. quoteReference(final String reference)
  4. quoteRegexMeta(final String input)
  5. quoteRegexMeta(String str)
  6. quoteRemarkSQL(String sql)
  7. quoteReplacement(String s)
  8. quoteReplacement(String s)
  9. quotes(CharSequence stringToQuote)