All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.baomidou.framework.common.util.HtmlUtil Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (c) 2011-2014, hubin ([email protected]).
 *
 * 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.baomidou.framework.common.util;

/**
 * 

* HTML工具类 *

* * @author hubin * @Date 2016-04-16 */ public class HtmlUtil { public static final String RE_HTML_MARK = "(<.*?>)|(<[\\s]*?/.*?>)|(<.*?/[\\s]*?>)"; public static final String RE_SCRIPT = "<[\\s]*?script[^>]*?>.*?<[\\s]*?\\/[\\s]*?script[\\s]*?>"; /** * 还原被转义的HTML特殊字符 * * @param htmlStr * 包含转义符的HTML内容 * @return 转换后的字符串 */ public static String restoreEscaped(String htmlStr) { if (htmlStr == null || "".equals(htmlStr)) { return htmlStr; } return htmlStr.replace("<", "<").replace("<", "<").replace(">", ">").replace("&", "&") .replace(""", "\"").replace("'", "'").replace(" ", " "); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy