Advertisement
CotaIgnorada

Tokenizer

May 26th, 2015
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. package ejerciciotokenizer;
  2. import java.util.StringTokenizer;
  3.  
  4.  
  5.  
  6. public class Ejerciciotokenizer {
  7.  
  8. /**
  9. * @param args the command line arguments
  10. */
  11. public static void main(String[] args) {
  12. String frase = "(15-10-2012) # Constanza Pardo # 19";
  13. StringTokenizer s = new StringTokenizer(frase, "#");
  14. if(s.hasMoreElements()){ //comprueba si despues del gatito hay mas contenido
  15. System.out.println("La fecha es"+ s.nextToken());
  16. System.out.println("El nombre es"+ s.nextToken());
  17. System.out.println("Edad"+ s.nextToken());
  18. }
  19. }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement