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.
这是用于计算完美工作的单词数量的代码。
st=new StringTokenizer(str); while(st.hasMoreTokens()) { String s=st.nextToken(); count++; }
计算字符数的代码是什么?
试试这个:
String str = "your string"; int count = str.length( );
该length()方法返回字符串的长度
length()