我得到以下字符串:
String line = "#food was testy. #drink lots of. #night was fab. #three #four";
Run Code Online (Sandbox Code Playgroud)
我想借此#food #drink #night #three和#four从它.
我试过这段代码:
String[] words = line.split("#");
for (String word: words) {
System.out.println(word);
}
Run Code Online (Sandbox Code Playgroud)
但它给food was testy,drink lots of,nigth was fab,three和four.