Introduction to Java Programming编程题9.6<统计字符串中字母的个数>
来源:互联网 发布:小学生网络安全教育 编辑:程序博客网 时间:2024/06/04 18:14
/*Enter a string: Joe going out, 78011 characters. */import java.util.Scanner;public class CountLetter { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter a string: "); String str = input.nextLine(); int totalLetter = countsLetter(str); System.out.println(totalLetter + " characters."); } public static int countsLetter(String s) { int count = 0; for (int i = 0; i < s.length(); i++) { if (Character.isLetter(s.charAt(i))) count++; } return count; }}
0 0
- Introduction to Java Programming编程题9.6<统计字符串中字母的个数>
- Introduction to Java Programming编程题9.5<统计字符串中数字的个数>
- Introduction to Java Programming编程题9.15<求字符串中大写字母的个数>
- Introduction to Java Programming编程题9.14<求字符串中整数的和>
- Introduction to Java Programming编程题6.7<统计0~9随机数出现的次数>
- Java统计字符串中各种字母个数
- 统计字符串中大小写字母的个数
- 统计字符串中字母出现的个数
- 统计字符串中每个字母的个数
- 统计字符串中每个字母的个数
- 统计字符串中字母个数
- 统计字符串中字母个数
- Introduction to Java Programming编程题9.17<统计文件行、字符、单词数>
- Introduction to Java Programming编程题9.13<回文字符串(在命令行传字符串)>
- Introduction to Java Programming编程题9.7<将字符串中的字符转换为数字>
- Introduction to Java Programming编程题9.11<对字符串中的字符排序(支持大小写混排)>
- java统计字符串中数字、大小写字母、空格个数
- 用数组编程字符,并统计出字符串中大小写字母的个数
- Linux环境变量修改
- 抓石子问题——不用递归写斐波那契函数来解决
- HDU 1754 I hate it
- JAVA问题总结之5-易错点之连接符和加号分析
- 黑马程序员_反射
- Introduction to Java Programming编程题9.6<统计字符串中字母的个数>
- linux的环境变量文件enviroment 、profile、bashrc和bash_profile的区别
- 海贼王片头旁白前后两篇
- vs2010编译配置boost
- 8.21: Hackday、慈善x快速迭代
- Android中的windowSoftInputMode属性详解
- UI18_UICollectionView
- 黑马程序员_正则表达式
- Java心得20