Java String Translate translate(String s)

Here you can find the source of translate(String s)

Description

translate

License

Open Source License

Declaration

private static char translate(String s) 

Method Source Code

//package com.java2s;

public class Main {
    private static char translate(String s) {
        switch (s) {
        case "&":
            return '&';
        case "<":
        case "≪":
            return '<';
        case "&gt;":
        case "&Gt;":
            return '>';
        case "&quot;":
            return '\"';
        case "&apos;":
            return '\'';
        case "&ast;":
        case "&sharp;":
            return '-';
        case "&equals;":
            return '=';
        case "&nbsp;":
            return (char) 0xA0;
        case "&iexcl;":
            return (char) 0xA1;
        case "&cent;":
        case "&shilling;":
            return (char) 0xA2;
        case "&pound;":
            return (char) 0xA3;
        case "&curren;":
            return (char) 0xA4;
        case "&yen;":
            return (char) 0xA5;
        case "&brvbar;":
            return (char) 0xA6;
        case "&sect;":
            return (char) 0xA7;
        case "&uml;":
            return (char) 0xA8;
        case "&copy;":
            return (char) 0xA9;
        case "&ordf;":
            return (char) 0xAA;
        case "&laquo; ":
            return (char) 0xAB;
        case "&not;":
            return (char) 0xAC;
        case "&shy; ":
            return (char) 0xAD;
        case "&reg;":
            return (char) 0xAE;
        case "&macr;":
            return (char) 0xAF;
        case "&deg;":
            return (char) 0xB0;
        case "&plusmn;":
            return (char) 0xB1;
        case "&sup2;":
            return (char) 0xB2;
        case "&sup3;":
            return (char) 0xB3;
        case "&acute;":
            return (char) 0xB4;
        case "&micro;":
            return (char) 0xB5;
        case "&middot;":
            return (char) 0xB7;
        case "&cedil;":
            return (char) 0xB8;
        case "&sup1;":
            return (char) 0xB9;
        case "&ordm;":
            return (char) 0xBA;
        case "&raquo;":
            return (char) 0xBB;
        case "&frac14; ":
            return (char) 0xBC;
        case "&frac12;":
            return (char) 0xBD;
        case "&frac34; ":
            return (char) 0xBE;
        case "&iquest;":
            return (char) 0xBF;
        case "&Agrave;":
            return (char) 0xC0;
        case "&Aacute;":
            return (char) 0xC1;
        case "&Acirc;":
            return (char) 0xC2;
        case "&Atilde;":
            return (char) 0xC3;
        case "&Auml;":
            return (char) 0xC4;
        case "&Aring;":
            return (char) 0xC5;
        case "&AElig;":
            return (char) 0xC6;
        case "&Ccedil;":
            return (char) 0xC7;
        case "&Egrave;":
            return (char) 0xC8;
        case "&Eacute;":
            return (char) 0xC9;
        case "&Ecirc;":
            return (char) 0xCA;
        case "&Euml;":
            return (char) 0xCB;
        case "&Igrave;":
            return (char) 0xCC;
        case "&Iacute;":
            return (char) 0xCD;
        case "&Icirc;":
            return (char) 0xCE;
        case "&Iuml;":
            return (char) 0xCF;
        case "&ETH;":
            return (char) 0xD0;
        case "&Ntilde;":
            return (char) 0xD1;
        case "&Ograve;":
            return (char) 0xD2;
        case "&Oacute;":
            return (char) 0xD3;
        case "&Ocirc;":
            return (char) 0xD4;
        case "&Otilde;":
            return (char) 0xD5;
        case "&Ouml;":
            return (char) 0xD6;
        case "&times;":
            return (char) 0xD7;
        case "&Oslash;":
            return (char) 0xD8;
        case "&Ugrave;":
            return (char) 0xD9;
        case "&Uacute;":
            return (char) 0xDA;
        case "&Ucirc;":
            return (char) 0xDB;
        case "&Uuml;":
            return (char) 0xDC;
        case "&Yacute;":
            return (char) 0xDD;
        case "&THORN;":
            return (char) 0xDE;
        case "&szlig;":
            return (char) 0xDF;
        case "&agrave;":
            return (char) 0xE0;
        case "&aacute;":
            return (char) 0xE1;
        case "&acirc;":
            return (char) 0xE2;
        case "&atilde;":
            return (char) 0xE3;
        case "&auml;":
            return (char) 0xE4;
        case "&aring;":
            return (char) 0xE5;
        case "&aelig;":
            return (char) 0xE6;
        case "&ccedil;":
            return (char) 0xE7;
        case "&egrave;":
            return (char) 0xE8;
        case "&eacute;":
            return (char) 0xE9;
        case "&ecirc;":
            return (char) 0xEA;
        case "&euml; ":
            return (char) 0xEB;
        case "&igrave;":
            return (char) 0xEC;
        case "&iacute;":
            return (char) 0xED;
        case "&icirc;":
            return (char) 0xEE;
        case "&iuml;":
            return 0xEF;
        case "&eth;":
            return (char) 0xF0;
        case "&ntilde;":
            return (char) 0xF1;
        case "&ograve;":
            return (char) 0xF2;
        case "&oacute;":
            return (char) 0xF3;
        case "&ocirc;":
            return (char) 0xF4;
        case "&otilde;":
            return (char) 0xF5;
        case "&ouml;":
            return (char) 0xF6;
        case "&divide;":
            return (char) 0xF7;
        case "&oslash;":
            return (char) 0xF8;
        case "&ugrave;":
            return (char) 0xF9;
        case "&uacute;":
            return (char) 0xFA;
        case "&ucirc;":
            return (char) 0xFB;
        case "&uuml;":
            return (char) 0xFC;
        case "&yacute;":
            return (char) 0xFD;
        case "&thorn;":
            return (char) 0xFE;
        case "&yuml;":
            return (char) 0xFF;
        case "&OElig;":
            return (char) 0x152;
        case "&oelig;":
            return (char) 0x153;
        case "&Scaron;":
            return (char) 0x160;
        case "&scaron;":
            return (char) 0x161;
        case "&Yuml;":
            return (char) 0x178;
        case "&circ;":
            return (char) 0x2C6;
        case "&tilde;":
            return (char) 0x2DC;
        case "&lrm;":
            return (char) 0x200E;
        case "&rlm;":
            return (char) 0x200F;
        case "&ndash;":
            return (char) 0x2013;
        case "&mdash;":
            return (char) 0x2014;
        case "&lsquo;":
            return (char) 0x2018;
        case "&rsquo;":
            return (char) 0x2019;
        case "&sbquo;":
            return (char) 0x201A;
        case "&ldquo;":
        case "&bquo;":
        case "&bq;":
            return (char) 0x201C;
        case "&rdquo;":
        case "&equo;":
            return (char) 0X201D;
        case "&bdquo;":
            return (char) 0x201E;
        case "&sim;":
            return (char) 0x223C;
        case "&radic;":
            return (char) 0x221A;
        case "&le;":
            return (char) 0x2264;
        case "&ge;":
            return (char) 0x2265;
        case "&larr;":
            return (char) 0x2190;
        case "&darr;":
            return (char) 0x2193;
        case "&rarr;":
            return (char) 0x2192;
        case "&hellip;":
            return (char) 0x2026;
        case "&prime;":
            return (char) 0x2032;
        case "&Prime;":
        case "&ins;":
            return (char) 0x2033;
        case "&trade;":
            return (char) 0x2122;
        case "&Alpha;":
        case "&Agr;":
            return (char) 0x391;
        case "&Beta;":
        case "&Bgr;":
            return (char) 0x392;
        case "&Gamma;":
        case "&Ggr;":
            return (char) 0x393;
        case "&Delta;":
        case "&Dgr;":
            return (char) 0x394;
        case "&Epsilon;":
        case "&Egr;":
            return (char) 0x395;
        case "&Zeta;":
        case "&Zgr;":
            return (char) 0x396;
        case "&Eta;":
            return (char) 0x397;
        case "&Theta;":
        case "&THgr;":
            return (char) 0x398;
        case "&Iota;":
        case "&Igr;":
            return (char) 0x399;
        case "&Kappa;":
        case "&Kgr;":
            return (char) 0x39A;
        case "&Lambda;":
        case "&Lgr;":
            return (char) 0x39B;
        case "&Mu;":
        case "&Mgr;":
            return (char) 0x39C;
        case "&Nu;":
        case "&Ngr;":
            return (char) 0x39D;
        case "&Xi;":
        case "&Xgr;":
            return (char) 0x39E;
        case "&Omicron;":
        case "&Ogr;":
            return (char) 0x39F;
        case "&Pi;":
        case "&Pgr;":
            return (char) 0x3A0;
        case "&Rho;":
        case "&Rgr;":
            return (char) 0x3A1;
        case "&Sigma;":
        case "&Sgr;":
            return (char) 0x3A3;
        case "&Tau;":
        case "&Tgr;":
            return (char) 0x3A4;
        case "&Upsilon;":
        case "&Ugr;":
            return (char) 0x3A5;
        case "&Phi;":
        case "&PHgr;":
            return (char) 0x3A6;
        case "&Chi;":
        case "&KHgr;":
            return (char) 0x3A7;
        case "&Psi;":
        case "&PSgr;":
            return (char) 0x3A8;
        case "&Omega;":
        case "&OHgr;":
            return (char) 0x3A9;
        case "&alpha;":
        case "&agr;":
            return (char) 0x3B1;
        case "&beta;":
        case "&bgr;":
            return (char) 0x3B2;
        case "&gamma;":
        case "&ggr;":
            return (char) 0x3B3;
        case "&delta;":
        case "&dgr;":
            return (char) 0x3B4;
        case "&epsilon;":
        case "&egr;":
            return (char) 0x3B5;
        case "&zeta;":
        case "&zgr;":
            return (char) 0x3B6;
        case "&eta;":
        case "&eegr;":
            return (char) 0x3B7;
        case "&theta;":
        case "&thgr;":
            return (char) 0x3B8;
        case "&iota;":
        case "&igr;":
            return (char) 0x3B9;
        case "&kappa;":
        case "&kgr;":
            return (char) 0x3BA;
        case "&lambda;":
        case "&lgr;":
            return (char) 0x3BB;
        case "&mu;":
        case "&mgr;":
            return (char) 0x3BC;
        case "&nu;":
        case "&ngr;":
            return (char) 0x3BD;
        case "&xi;":
        case "&xgr;":
            return (char) 0x3BE;
        case "&omicron;":
        case "&ogr;":
            return (char) 0x3BF;
        case "&pi;":
        case "&pgr;":
            return (char) 0x3C0;
        case "&rho;":
        case "&rgr;":
            return (char) 0x3C1;
        case "&sigma;":
        case "&sgr;":
            return (char) 0x3C3;
        case "&tau;":
        case "&tgr;":
            return (char) 0x3C4;
        case "&upsilon;":
        case "&ugr;":
            return (char) 0x3C5;
        case "&phi;":
        case "&phgr;":
            return (char) 0x3C6;
        case "&chi;":
        case "&khgr;":
            return (char) 0x3C7;
        case "&psi;":
        case "&psgr;":
            return (char) 0x3C8;
        case "&omega;":
        case "&ohgr;":
            return (char) 0x3C9;
        case "&bull;":
            return (char) 0x2022;
        case "&percnt;":
            return '%';
        case "&plus;":
            return '+';
        case "&dash;":
            return '-';
        case "&abreve;":
        case "&amacr;":
        case "&ape;":
        case "&aogon;":
            return 'a';
        case "&Amacr;":
            return 'A';
        case "&cacute;":
        case "&ccaron;":
        case "&ccirc;":
            return 'c';
        case "&Ccaron;":
            return 'C';
        case "&dcaron;":
            return 'd';
        case "&ecaron;":
        case "&emacr;":
        case "&eogon;":
            return 'e';
        case "&Emacr;":
        case "&Ecaron;":
            return 'E';
        case "&lacute;":
            return 'l';
        case "&Lacute;":
            return 'L';
        case "&nacute;":
        case "&ncaron;":
        case "&ncedil;":
            return 'n';
        case "&rcaron;":
        case "&racute;":
            return 'r';
        case "&Rcaron;":
            return 'R';
        case "&omacr;":
            return 'o';
        case "&imacr;":
            return 'i';
        case "&sacute;":
        case "&scedil;":
        case "&scirc;":
            return 's';
        case "&Sacute":
        case "&Scedil;":
            return 'S';
        case "&tcaron;":
        case "&tcedil;":
            return 't';
        case "&umacr;":
        case "&uring;":
            return 'u';
        case "&wcirc;":
            return 'w';
        case "&Ycirc;":
            return 'Y';
        case "&ycirc;":
            return 'y';
        case "&zcaron;":
        case "&zacute;":
            return 'z';
        case "&Zcaron;":
            return 'Z';
        case "&hearts;":
            return (char) 0x2665;
        case "&infin;":
            return (char) 0x221E;
        case "&dollar;":
            return '$';
        case "&sub;":
        case "&lcub;":
            return (char) 0x2282;
        case "&sup;":
        case "&rcub;":
            return (char) 0x2283;
        case "&lsqb;":
            return '[';
        case "&rsqb;":
            return ']';
        default:/*w  w  w. j  a va 2  s . com*/
            return ' ';
        }
    }
}

Related

  1. translate(String input, String xmlName)
  2. translate(String message, String charsToBeReplaced, String replacementChars)
  3. translate(String name, int type)
  4. translate(String originalHtml)
  5. translate(String s)
  6. translate(String s, String identifier, String associator)
  7. translate(String s, String oldChars, String newChars)
  8. translate(String sequence, String match, String replacement)
  9. translate(String source)