|
|
|
|
Strumenti |
11-05-2009, 18:31 | #1 |
Senior Member
Iscritto dal: Aug 2005
Città: Genova
Messaggi: 2285
|
[JAVA] Problema a prendere una stringa e confrontare carattere
Raga ho questo problema: in pratica devo far inserire un stringa all'utente e confrontare se c'è un determinato carattere alla fine, in particolare il "/" e se non c'è aggiungerlo
Ho scritto questo codice Codice:
strTemp=JOptionPane.showInputDialog("Inserisci l'url del programma (in forma http:\\www...) "); if((strTemp.charAt(address.length()-1))!='/') address=strTemp+"/"; else address=strTemp; Exception in thread "main" java.lang.NullPointerException Cosa sto sbagliando? non capisco
__________________
Lego ™ Fans Club |
11-05-2009, 19:05 | #2 | |
Senior Member
Iscritto dal: Oct 2005
Messaggi: 1026
|
Quote:
Codice:
strTemp=JOptionPane.showInputDialog("Inserisci l'url del programma (in forma http:\\www...) "); if((strTemp.charAt(strTemp.length()-1))!='/') address=strTemp+"/"; else address=strTemp; Ultima modifica di Energy++ : 11-05-2009 alle 19:09. |
|
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 23:38.