next()与nextLine()
来源:互联网 发布:python数据分析书籍 编辑:程序博客网 时间:2024/06/08 08:31
public static void TestString() {String str = null;Scanner inputScanner = new Scanner(System.in);// trim()去掉两边空格str = inputScanner.next().trim();/* * next()方法是不接收空格的,在接收到有效数据前,所有的空格或者tab键等输入被忽略,若有有效数据,则遇到这些键退出。 * nextLine()可以接收空格或者tab键,其输入应该以enter键结束。 */// 小写转大写System.out.println(str.toUpperCase());// 字符串转数组char[] temp = str.toCharArray();// 最后一个字母改成“。”temp[temp.length - 1] = '。';// 数组转成字符串String lastStr = new String(temp);// String.valueOf(temp);System.out.println(lastStr);// char d=str1.charAt(str1.length()-1); 获取最后一个字符// String d1=str1.replace(d, '。');}
0 0
- java:nextLine()与next()
- next()与nextLine()区别
- next()与nextLine()
- next() 与 nextLine() 区别
- next与nextLine区别探讨
- Scanner 的next() 与nextline()
- next()与nextLine的区别
- next() 与 nextLine()的区别
- next()&nextline()
- Scanner 中 next()与nextLine()的用法
- Scanner的next与nextLine方法
- Scanner 类中的 next() 与 nextLine() 区别
- Scanner中的next()与nextLine()的区别
- scanner.next()与scanner.nextLine()的区别
- Scanner中next()与nextLine()的区别
- Java之next()与nextline区别
- java中next与nextLine用法区别
- Scanner对象的next()与nextLine()区别
- memcached学习笔记1(windows 7 64bit 环境下安装memcached)
- 配置Apache svn 服务器
- [LeetCode]016-3Sum-Closest
- Android 和 iOS 的区别
- week14---12月8日 JS内置对象——string、Date
- next()与nextLine()
- 一些iOS常用的第三方库和控件
- 【2015广东工业大学新生赛A】【排序 二进制数位思想】GG和女神 数字按照数值排序后取了多少个数
- Opencv 任意区域选中
- http 头信息详解
- 亲情无价
- 【2015广东工业大学新生赛B】【数论 素因子拆分】小刀带你们玩游戏 lcm(A,B)==C下B的个数
- 应用跳转到系统设置里的各种设置界面
- 【2015广东工业大学新生赛C】【贪心 快速幂】长度为n的最小47倍数