public int levelCount(String str){
int count = 0;
int start = 0;
while (str.indexOf("-", start) >= 0 && start < str.length()) {
count++;
start = str.indexOf("-", start) + "-".length();
}
return count;
}
转载请注明原文地址:https://ipadbbs.8miu.com/read-53019.html