Java Utililty Methods Char Array to Entity

List of utility methods to do Char Array to Entity

Description

The list of methods to do Char Array to Entity are organized into topic(s).

Method

StringcharsToEntities(String str)
Converts <, >, & in the string to their HTML entity equivalents.
StringBuffer buf = new StringBuffer(str.length());
for (int i = 0; i < str.length(); i++) {
    char ch = str.charAt(i);
    switch (ch) {
    case '<':
        buf.append("&lt;");
        break;
    case '>':
...
StringcharsToEntities(String str, boolean xml11)
Converts <, >, & in the string to their HTML entity equivalents.
StringBuilder buf = new StringBuilder(str.length());
for (int i = 0; i < str.length(); i++) {
    char ch = str.charAt(i);
    if (((0x00 <= ch && ch <= 0x1F) || (0x7F <= ch && ch <= 0x9F)) && ch != '\r' && ch != '\n'
            && ch != '\t') {
        if (xml11 && ch != 0x00) {
            buf.append("&#").append((int) ch).append(';');
        } else {
...