package com.netauth.utils.common; /** * * * <p> * 特殊字符常量 * </p> * * <p> * 版权所有:神州融信信息技术有限公司(c) 2019 * </p> * @date 2021年3月3日 * @author wyh * */ public class CharConst { /** * 全角双引号 */ public static String FULL_WIDTH_DOUBLE = "“"; public static String FULL_WIDTH_DOUBLE_ = """; /** * 半角双引号 */ public static String HALF_WIDTH_DOUBLE = "\""; public static String FULL_WIDTH_LESS = "<"; public static String FULL_WIDTH_GREATER = ">"; public static String HALF_WIDTH_LESS = "<"; public static String HALF_WIDTH_GREATER = ">"; public static String FULL_SINGLE_DOUBLE = "‘"; public static String HALF_SINGLE_LESS = "\'"; /** * 全角\ */ public static String FULL_BASKSLASH_GREATER = "\"; /** * 半角\ */ public static String HALF_BASKSLASH_GREATER = "\\"; /** * 全角% */ public static String FULL_PERCENT_GREATER = "%"; /** * 半角% */ public static String HALF_PERCENT_GREATER = "%"; /** * 反斜杠 backslash */ public static String BACKSLASH = "\\\\"; /** * 正斜杠 */ public static String FORWARD_BACKSLASH = "/"; /** * * 字符串转义 * @param regs * @return * @return String * @author jlcui * @date 2021年7月16日上午11:20:55 */ public static String getReg(String regs) { regs = regs.replaceAll(CharConst.FULL_PERCENT_GREATER, CharConst.HALF_PERCENT_GREATER); regs = regs.replaceAll(CharConst.FULL_WIDTH_LESS, CharConst.HALF_WIDTH_LESS); regs = regs.replaceAll(CharConst.FULL_WIDTH_GREATER, CharConst.HALF_WIDTH_GREATER); regs = regs.replaceAll(CharConst.FULL_WIDTH_DOUBLE, CharConst.HALF_WIDTH_DOUBLE); regs = regs.replace(CharConst.FULL_BASKSLASH_GREATER, CharConst.HALF_BASKSLASH_GREATER); return regs; } }