I got the following string:
String line = "#food was testy. #drink lots of. #night was fab. #three #four";
I want to take #food #drink #night #three and #four from it.
I tried this code:
String[] words = line.split("#");
for (String word: words) {
System.out.println(word);
}
But from it gives "food was testy","drink lots of","nigth was fab","three" and "four".
Aucun commentaire:
Enregistrer un commentaire