fork download
  1. import java.io.*;
  2.  
  3. class Test {
  4. public static void main(String args[]) {
  5. String line = new String("banana*batata.pepino#alface_tomate@cenoura abacate/morango\\laranja");
  6. for (String retval: line.split(" |#|@|_|\\\\|\\/|\\.|\\*") ){
  7. System.out.println(retval);
  8. }
  9.  
  10. }
  11. }
  12.  
  13. //https://pt.stackoverflow.com/q/41990/101
Success #stdin #stdout 0.05s 2249728KB
stdin
Standard input is empty
stdout
banana
batata
pepino
alface
tomate
cenoura
abacate
morango
laranja