Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我这样做是为了在管道上拆分字符串。
wordarray = comments.split("\\|");
我希望该字符串在管道和冒号上分开:
有没有办法可以将它们组合成命令?就像是:
wordarray = comments.split("\\|",":")
注意,我希望它在所有事件上分开,而不仅仅是第一个
您可以为此使用字符类。考虑这段代码:
String[] wordarray = comments.split("[|:]");