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.
谁能告诉我可以使用什么函数来获取分隔字符串中分隔字符串的数量?例如,如果我有
String time = "hh:mm:ss";
该函数将返回3,因为存在三个分隔的字符串:hh, mm,ss 谢谢!
3
hh
mm
ss
尝试这样的事情:
"hh:mm:ss".split(":").length
您可以在此处阅读有关该split方法的更多信息。
split