io.polaris.core.string.XmlEscape Maven / Gradle / Ivy
package io.polaris.core.string;
/**
* @author Qt
* @since 1.8
*/
public class XmlEscape extends StringReplacerChain {
public static final String[][] BASIC_ESCAPE = { //
{"'", "'"}, // " - single-quote
{"\"", """}, // " - double-quote
{"&", "&"}, // & - ampersand
{"<", "<"}, // < - less-than
{">", ">"}, // > - greater-than
};
public XmlEscape() {
for (String[] escape : BASIC_ESCAPE) {
add(s -> s.replace(escape[0], escape[1]));
}
}
}