Java tutorial
/* * Copyright (C) 2017 Baifendian Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.baifendian.swordfish.execserver.job.impexp; import org.apache.commons.lang.StringUtils; /** * */ public class ImpExpUtil { /** * ??? */ public static String exceptBackQuota(String str) { // ???2 if (StringUtils.isEmpty(str) || str.length() < 2) { return str; } char first = str.charAt(0); if (first == '`') { str = str.substring(1); } char last = str.charAt(str.length() - 1); if (last == '`') { str = str.substring(0, str.length() - 1); } return str; } /** * ??? */ public static String addBackQuota(String str) { //?? if (StringUtils.isEmpty(str)) { return str; } char first = str.charAt(0); if (first == '`') { str = "`" + str; } char last = str.charAt(str.length() - 1); if (last == '`') { str += "`"; } return str; } /** * ????? */ public static boolean equalIgnoreCaseWithoutBackQuota(String str1, String str2) { return StringUtils.equalsIgnoreCase(exceptBackQuota(str1), exceptBackQuota(str2)); } }