You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

718 B

字符串

输入与输出

-next不能输入空格 -nextLine可以输入空格

输入流

  • // System.in 读取键盘上的数据
  • // InputStreamReader 将字节流向字符流的转换
  • InputStreamReader isr = new InputStreamReader(System.in); // 读取
  • // 创建字符流缓冲区
  • BufferedReader br = new BufferedReader(isr); // 缓冲
  • // 读取一个文本行
  • String s = br.readLine(); // 阻塞式当没有数据读取时就一直会阻塞而不是返回null
  • img_1.png

连续输入

  • 利用Buffer连续readLine读取不同的行

Ascii对照表

关键参数 A65 a97 32 1 49 img.png

字符串替换

-str.replaceAll(a,b)