Advertisement
cotolonco

Matches

Jul 15th, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1. public class Login
  2. {
  3.   public static void validarUsuario( String usuario )
  4.   {
  5.     boolean bool = usuario.matches( "\\w+" );
  6.     System.out.println( "Usuario Válido: " + bool );
  7.   }
  8.  
  9.   public static void main( String[] args )
  10.   {
  11.     Login.validarUsuario( "hola0,123" ); //False
  12.     Login.validarUsuario( "" ); //False
  13.     Login.validarUsuario( "hola0123" ); //True
  14.   }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement