Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String escapeAttribute(String attribute) {
        return escapeAttribute(attribute, true);
    }

    public static String escapeAttribute(String attribute, boolean escapeEntities) {
        if (attribute == null)
            return "";
        String ret = attribute;
        if (escapeEntities)
            ret = ret.replace("&", "&");
        return ret.replace("\"", """).replace("'", "'");
    }
}