计算单词数
来源:互联网 发布:北京新华电脑学校java 编辑:程序博客网 时间:2024/05/01 15:35
public class CountWords { public static void main(String[] args) { String s = " i am hehao "; //wordCount(s); wordCount1(s); } public static void wordCount(String str){ String[]s1 = str.trim().split(" "); System.out.println(s1.length); } public static void wordCount1(String str){ int word = 0; int count = 0; for(int j=0;j< str.length();j++){ if(str.charAt(j)==' '){ word = 0; } else if(word==0){ word=1; count++; } } System.out.println(count); }}
阅读全文
0 0
- 18.计算单词数
- 18.计算单词数
- 计算单词数
- 计算句子中的单词数
- 计算文件中的单词数
- 计算字符串中的单词数
- 计算字符串中包含的单词数
- 计算单词数--空格不一定一个
- 计算字符串中的单词数. 单词:由空格分开的连续字母数字串。
- 计算字符串中的单词数(单词:由空格分开的连续字母数字串)
- 计算(中英法俄日葡韩阿文)的单词数
- 第二周任务3-1 计算单词数
- 计算文本单词数、行数,并创建一维数组
- 使用Hadoop的mapReduce实现计算单词数
- 计算字符串中的单词数,并将其输出
- 数单词
- 单词数
- 单词数
- 判断两个字符串是否由相同的字符组成
- Java向上向下转型问题
- 数学 gcd
- 在乐视2手机上解决kindle阅读器即译时音标显示正常的问题
- 【线段树+Hash】Codeforces452F[Permutation]题解
- 计算单词数
- Windows7 创建右键发送到桌面的快捷方式
- 处理百万级以上的数据提高查询速度的方法。
- 从尾到头打印链表 【C++实现】
- hdu5972 Regular Number (bitset应用+快速匹配+shiftAnd匹配算法学习模板)
- 第二十课 管理事务处理
- 数字全排列
- mysql安装教程
- Linux下C++的编程几个重要的工具和概念