作者:黑衬衫1994 | 来源:互联网 | 2023-10-11 23:10
本文由编程笔记#小编为大家整理,主要介绍了java 字符串 - 理解字符串相关的知识,希望对你有一定的参考价值。
public static void main(String[] args) {
String word = "10 Things I Hate About You";
// ["10", "Things", "I", "Hate", "About", "You"]
String splitWord[] = word.split("\\s");
for (int i = 0; i System.out.println(splitWord[i]);
}
}