Ver Mensaje Individual
  #2 (permalink)  
Antiguo 19/06/2003, 08:41
Avatar de kripton
kripton
 
Fecha de Ingreso: diciembre-2002
Ubicación: Zaragoza
Mensajes: 296
Antigüedad: 21 años, 4 meses
Puntos: 0
Hola cadapo!!!

Puedes hacer lo siguiente:
Código PHP:
        String cadena campo.getText(); //recoges el contenido del campo
        
boolean algunDigito false;
        
boolean algunaLetra false;
        for (
int i 0cadena.length(); i++) {
            if (
Character.isDigit(cadena.charAt(i))) {
                
//es un digito
                
algunDigito true;
            } else {
                
algunaLetra true;
                
//no es un digito
            
}
        }
        if(
algunDigito && !algunaLetra){
            
System.out.println("TODO DIGITOS");
        }else if (
algunDigito){
            
System.out.println("ALFNUMERICOS");
        }else{
            
System.out.println("TODO LETRAS");
        } 
Espero te sirva,
un saludo
kripton