replace Mark from HTML String - Java java.lang

Java examples for java.lang:String Replace

Description

replace Mark from HTML String

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) {
        String content = "java2s.com";
        System.out.println(replaceMark(content));
    }/*from  w  w  w . j  av a2s  .  c om*/

    public static String replaceMark(String content) {
        String strContent = "";
        String strMark = "<\\s*[^>]*>";
        strContent = content.trim();
        strContent = strContent.replaceAll("\"", "");
        strContent = strContent.replaceAll("\'", "");
        //????<>??
        strContent = strContent.replaceAll(strMark, "");
        strContent = strContent.replaceAll("&nbsp;", "");
        strContent = strContent.replaceAll(" ", "");
        strContent = strContent.replaceAll("?", "");
        strContent = strContent.replaceAll("\r", "");
        strContent = strContent.replaceAll("\n", "");
        strContent = strContent.replaceAll("\r\n", "");
        return strContent;
    }
}

Related Tutorials