Here you can find the source of wildcardSqlToUser(String exp)
Parameter | Description |
---|---|
exp | the wildcard expression |
@Deprecated public static String wildcardSqlToUser(String exp)
//package com.java2s; /*/*from www . j a v a 2s.c om*/ * Copyright (C) 2002-2017 FlyMine * * This code may be freely distributed and modified under the * terms of the GNU Lesser General Public Licence. This should * be distributed with the code. See the LICENSE file for more * information or http://www.gnu.org/copyleft/lesser.html. * */ public class Main { /** * Convert an SQL LIKE/NOT LIKE expression to a * wildcard expression. See * wildcardUserToSql method for more information. * @param exp the wildcard expression * @return the SQL LIKE parameter * @deprecated I don't think this is used anymore? */ @Deprecated public static String wildcardSqlToUser(String exp) { StringBuffer sb = new StringBuffer(); // Java needs backslashes to be backslashed in strings. for (int i = 0; i < exp.length(); i++) { String substring = exp.substring(i); if (substring.startsWith("%")) { sb.append("*"); } else { if (substring.startsWith("_")) { sb.append("?"); } else { if (substring.startsWith("\\%")) { sb.append("%"); i++; } else { if (substring.startsWith("\\_")) { sb.append("_"); i++; } else { if (substring.startsWith("*")) { sb.append("\\*"); } else { if (substring.startsWith("?")) { sb.append("\\?"); } else { // a single '\' as in Dpse\GA10108 if (substring.startsWith("\\\\")) { i++; sb.append("\\"); } else { sb.append(substring.charAt(0)); } } } } } } } } return sb.toString(); } }