 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Mess Guest
|
Posted: Mon May 22, 2006 6:10 pm Post subject: String-he e Container |
|
|
Ciao a Tutti,
ho un problema legato alle lettere accentate ed all'encoding. Il mio
codice non deve fare altro che prendere una frase, passarla ad un metodo
che deve eliminare tutte le parole contenute in un duzionardio.
Premetto che il dizionario in questione non è altro che un ArrayList che
contiene delle stringhe.
Quindi dopo aver tokenizzato la frase con StringTokenizer controllo se
le parole sono contenute nell'ArrayList di prima. Il fatto è che se faccio:
hm.contains( "perchè" );
il valore ritornato è sempre false. Ma se poi stampo il contenuto
dell'ArrayList la parole compare nel dizionario. Vuoi che ne dite?
All'inizio pensavo che fosse un problema di enconding tra stringhe ma il
confronto fra stringhe funziona correttamente.
....
String word1 = "perch\u00e8";
String word2 = "perchè";
if(word1.compareTo(word2)==0 )
System.out.println("String compare \'"+ word1 +"\' = \'"+ word2 +"\' ");
else
fail("String compare \'"+ word1 +"\' != \'"+ word2 +"\' ");
....
Ringrazio chiunque per l'aiuto.
--
Mess
http://www.mibmagazine.it |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|