Here you can find the source of htmlEntities(String s)
Parameter | Description |
---|---|
s | a string |
public static String htmlEntities(String s)
//package com.java2s; /***************************************************************************** * * Copyright 2012-2016 SkillPro Consortium * * Author: PDE, FZI, pde@fzi.de/*from w w w . j a v a 2s.c o m*/ * * Date of creation: 2012-2016 * * Module: AMS Server * * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * This file is part of the AMS (Asset Management System), which has been developed * at the PDE department of the FZI, Karlsruhe. It is part of the SkillPro Framework, * which is is developed in the SkillPro project, funded by the European FP7 * programme (Grant Agreement 287733). * * The SkillPro Framework is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The SkillPro Framework is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with the SkillPro Framework. If not, see <http://www.gnu.org/licenses/>. *****************************************************************************/ public class Main { /** * Escapes special html characters in a string, namely &, <, > and ". * @param s a string * @return the escaped string */ public static String htmlEntities(String s) { s = s.replace("&", "&"); s = s.replace("<", "<"); s = s.replace(">", ">"); s = s.replace("\"", """); return s; } }