这是用于统计完美运作的单词数量的代码。
st=new StringTokenizer(str);
while(st.hasMoreTokens())
{
String s=st.nextToken();
count++;
}
计算字符数的代码是什么?
答案 0 :(得分:5)
试试这个:
String str = "your string";
int count = str.length( );
length()
方法返回字符串的长度