Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String getAsTagValue(String value) {
        if (value != null && value.length() > 0) {

            // @author changes Medet, CDATA
            if (value.startsWith("<![CDATA[") && value.endsWith("]]>")) {
                return value;
            }
            //

            String val = value.replace("&", "&amp;");
            val = val.replace("\n", "");
            val = val.replace("\"", "'");
            val = val.replace("\r", "");
            val = val.replace("\"", "&quot;");
            val = val.replace("<", "&lt;").replace(">", "&gt;");
            return val;
        } else {
            return "";
        }
    }
}