📄 findchar.java
字号:
import java.io.*;
public class Findchar {
public static void main(String[] args) throws Exception {
if (args.length != 2) {
throw new Exception("need char / file");
}
int match = args[0].charAt(0);
FileInputStream
fileIn = new FileInputStream(args[1]);
LineNumberInputStream
in = new LineNumberInputStream(fileIn);
int ch;
while ( (ch = in.read()) != -1) {
if (ch == match) {
System.out.println
("‘" + (char) ch + "’at line" +in.getLineNumber());
System.exit(0);
}
}
System.out.println(ch + "not found");
System.exit(1);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -