Fórum Como limitar tamanho de String #568099
09/04/2009
0
Thiago Melo
Curtir tópico
+ 0Posts
09/04/2009
Thiago Melo
Gostei + 0
09/04/2009
Thiago Melo
Gostei + 0
09/04/2009
Vitor Pamplona
Gostei + 0
09/04/2009
Vitor Pamplona
Gostei + 0
09/04/2009
0
Thiago Melo
Curtir tópico
+ 0Posts
09/04/2009
Thiago Melo
Gostei + 0
09/04/2009
Thiago Melo
Gostei + 0
09/04/2009
Vitor Pamplona
Gostei + 0
09/04/2009
Vitor Pamplona
Gostei + 0
09/04/2009
Vitor Pamplona
Gostei + 0
09/04/2009
Vitor Pamplona
Gostei + 0
09/04/2009
Vitor Pamplona
Gostei + 0
09/04/2009
Bruno Navarro
public static void main(String[] args)
{
final int MAX_VALOR = 30;
String varStr;
do
{
varStr = JOptionPane.showInputDialog("Max " +MAX_VALOR+ " letras:");
if (varStr.length() > MAX_VALOR)
{
JOptionPane.showMessageDialog(null,"Digite novamente");
}
}while(varStr.length() > MAX_VALOR);
JOptionPane.showMessageDialog(null,varStr);
}
Gostei + 0
09/04/2009
Lucas Teixeira
Gostei + 0
09/04/2009
Kuesley
class StringLimitada {
private String texto;
public void setText(String value) {
if (value.lenght() > 30) throw new GrandeException();
texto = value;
}
public String getText() {
return this.texto;
}
}Gostei + 0
09/04/2009
Carlos Heuberger
Gostei + 0
09/04/2009
Vitor Pamplona
Gostei + 0
09/04/2009
Thiago Melo
Gostei + 0
09/04/2009
Thiago Melo
Gostei + 0
09/04/2009
Thiago Melo
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)
Inserção de url
Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.