DJ ParserText

0 respostas
sotarelli

package evangelizamail;

import java.util.HashMap;

public class ParserText
{

public String parser (String texto) 
{
	
	HashMap hm = new HashMap();
	int totalCaracter = texto.length();
	String aux;
	StringBuffer novoTexto = new StringBuffer();
	
	hm.put("!","!");
	hm.put("�","£");
	hm.put("�","Ã");
	hm.put("�","ã");
	hm.put("\"",""");
	hm.put("�","¤");
	hm.put("�","Ä");
	hm.put("�","ä");
	hm.put("#","#");
	hm.put("�","¥");
	hm.put("�","Å");
	hm.put("�","å");
	hm.put("$","$");
	hm.put("�","¦");
	hm.put("�","Æ");
	hm.put("�","æ");
	hm.put("%","%");
	hm.put("�","§");
	hm.put("�","Ç");
	hm.put("�","ç");
	hm.put("&","&");
	hm.put("�","¨");
	hm.put("�","È");
	hm.put("�","è");
	hm.put("","'");
	hm.put("�","©");
	hm.put("�","É");
	hm.put("�","é");
	hm.put("(","(");
	hm.put("�","ª");
	hm.put("�","Ê");
	hm.put("�","ê");
	hm.put(")",")");
	hm.put("�","«");
	hm.put("�","Ë");
	hm.put("�","ë");
	hm.put("*","*");
	hm.put("�","¬");
	hm.put("�","Ì");
	hm.put("�","ì");
	hm.put("+","+");
	hm.put("�","­");
	hm.put("�","Í");
	hm.put("�","í");
	hm.put(",",",");
	hm.put("�","®");
	hm.put("�","Î");
	hm.put("�","î");
	hm.put("-","-");
	hm.put("�","¯");
	hm.put("�","Ï");
	hm.put("�","ï");
	hm.put(".",".");
	hm.put("�","°");
	hm.put("�","Ð");
	hm.put("�","ð");
	hm.put("/","/");
	hm.put("�","±");
	hm.put("�","Ñ");
	hm.put("�","ñ");
	hm.put("�","²");
	hm.put("�","Ò");
	hm.put("�","ò");
	hm.put("�","Ý");
	hm.put("�","³");
	hm.put("�","Ó");
	hm.put("�","ó");
	hm.put("�","ý");
	hm.put("�","´");
	hm.put("�","Ô");
	hm.put("�","ô");
	hm.put("�","Þ");
	hm.put("�","µ");
	hm.put("�","Õ");
	hm.put("�","õ");
	hm.put("�","þ");
	hm.put("�","¶");
	hm.put("�","Ö");
	hm.put("�","ö");
	hm.put("�","ÿ");
	hm.put("�","·");
	hm.put("�","×");
	hm.put("�","÷");
	hm.put("�","ß");
	hm.put("�","¸");
	hm.put("�","Ø");
	hm.put("�","ø");
	hm.put("?","Ā");
	hm.put("�","¹");
	hm.put("�","Ù");
	hm.put("�","ù");
	hm.put("�","à");
	hm.put("�","º");
	hm.put("�","Ú");
	hm.put("�","ú");
	hm.put("�","á");
	hm.put("�","»");
	hm.put("�","Û");
	hm.put("�","û");
	hm.put("�","â");
	hm.put(":",":");
	hm.put("�","¼");
	hm.put("�","Ü");
	hm.put("�","ü");
	hm.put(";","&#59;");
	hm.put("[","[");
	hm.put("{","{");
	hm.put("�","½");
	hm.put("<","&#60;");
	hm.put("\\","&#92;");
	hm.put("|","&#124;");
	hm.put("&#65533;","&#190;");
	hm.put("=","&#61;");
	hm.put("]","&#93;");
	hm.put("}","&#125;");
	hm.put("&#65533;","&#191;");
	hm.put(">","&#62;");
	hm.put("^","&#94;");
	hm.put("~","&#126;");
	hm.put("&#65533;","&#192;");
	hm.put("?","&#63;");
	hm.put("_","&#95;");
	hm.put("&#65533;","&#161;");
	hm.put("&#65533;","&#193;");
	hm.put("@","&#64;");
	hm.put("`","&#96;");
	hm.put("&#65533;","&#162;");
	hm.put("&#65533;","&#194;");
	
	for(int i = 0;i <= totalCaracter; i++)
	{
		if(i < texto.length())
		{
			int iAux = i+1;
			aux = texto.substring(i,iAux);
			
			
			if (hm.containsKey(aux))
			{
				novoTexto.append(hm.get(aux));
			}
			else
			{
				novoTexto.append(aux);
			}
		}
		else
		{
			aux = texto.substring(i);
		}
		
	}
	
	texto = novoTexto.toString();
	
	System.out.println(texto);
	return texto;		
}

}

Criado 11 de julho de 2008
Respostas 0
Participantes 1