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 

Stringa delimitata

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





PostPosted: Tue May 25, 2004 9:48 am    Post subject: Stringa delimitata Reply with quote



C'è un modo per dichiarare una stringa con una dimensione massima? In
maniera che se viene superato il limite mi vada in errore o venga
tagliata!
Back to top
Hannibal
Guest





PostPosted: Tue May 25, 2004 1:55 pm    Post subject: Re: Stringa delimitata Reply with quote




non so ma credo di no...
(forse StringBuffer??)

potresti crearti una tua classe che eredita
da String e fare l'overidding dei metodi
ora però mi sorge un dubbio, dato che in java
non c'è l'overloading degli operatori come faresti quando hai:

String s = "";
s += "ciao";

in questo caso c'è un modo per "reimplimentare" il += ??
sarebbe interessante vedere come fa la libreria standard
a gestirlo...





Back to top
cthulhu
Guest





PostPosted: Tue May 25, 2004 5:51 pm    Post subject: Re: Stringa delimitata Reply with quote



Hannibal wrote:

Quote:
non so ma credo di no...
(forse StringBuffer??)

potresti crearti una tua classe che eredita
da String e fare l'overidding dei metodi

String è final..

Marco

--

reply: remove duh.spam.
http://javac.imap.cc

Back to top
Vincent Vega
Guest





PostPosted: Tue May 25, 2004 6:17 pm    Post subject: Re: Stringa delimitata Reply with quote

Alex wrote:

Quote:
C'è un modo per dichiarare una stringa con una dimensione massima? In
maniera che se viene superato il limite mi vada in errore o venga
tagliata!

Con String non puoi fare nulla.
Fai un wrapper e gestisci con quello.

Back to top
Alex
Guest





PostPosted: Wed May 26, 2004 9:42 am    Post subject: Re: Stringa delimitata Reply with quote

Ho creato una classe String con package java.lang con i metodi della
vera classe String e in + un mio costruttore (String stringa, int
max).
Quando in un file java di un qualunque package dichiaro una stringa e
chiamo il mio costruttore, NetBeans me lo visualizza ma il compilatore
non lo trova!
Ho lasciato perdere quella strada ma ormai tutte le stringhe hanno
quel costruttore. Comunque funzionano lo stesso.

Grazie a tutti!!!
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.