AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

String-he e Container

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian)
View previous topic :: View next topic  
Author Message
Mess
Guest





PostPosted: Mon May 22, 2006 6:10 pm    Post subject: String-he e Container Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.