Return to Snippet

Revision: 13085
at April 8, 2009 05:15 by walokra


Updated Code
/**
 * Replace the wildcard-character with defined charater for SQL queries
 * 
 * @param var
 *            value to be checked and replaced with proper wildcard
 * 
 * @return formatted String
 */
 public static String processWildCard(String var) {
     final String WILDCARD = "*";
     final String ORWILDCARD = "%";

     if (var.indexOf(WILDCARD) != -1) {
         System.out.println(">> found wildcard at index: " + var.indexOf(WILDCARD));
          var = org.springframework.util.StringUtils.replace(var, WILDCARD, ORWILDCARD);

          return var.toUpperCase();
     } else {
         return var.toUpperCase();
     }
 }

Revision: 13084
at April 8, 2009 05:13 by walokra


Initial Code
/**
     * Replace the wildcard-character with defined charater for SQL queries
     * 
     * @param var
     *            value to be checked and replaced with proper wildcard
     * 
     * @return formatted String
     */
    public static String processWildCard(String var) {
        final String WILDCARD = "*";
        final String ORWILDCARD = "%";

        if (var.indexOf(WILDCARD) != -1) {
                System.out.println(">> found wildcard at index: " + var.indexOf(WILDCARD));
            var = org.springframework.util.StringUtils
.replace(var, WILDCARD, ORWILDCARD);

            return var.toUpperCase();
        } else {
            return var.toUpperCase();
        }
    }

Initial URL

                                

Initial Description

                                

Initial Title
Replace the wildcard-character with defined charater for SQL queries

Initial Tags
sql, java

Initial Language
Java