public class Demo {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in)
int x = scan.nextInt()
System.out.println("输入的证书是:"+x)
}
File file = new File("txt路径")BufferedReader br = new BufferedReader(new FileReader(file))
List<Integer>list = new ArrayList<Integer>()
String tmp
while((tmp = br.readLine()) != null){
list.add(Integer.parseInt(tmp))
}
br.close()
代码如下:
import java.io.BufferedReaderimport java.io.File
import java.io.FileReader
import java.io.IOException
import java.util.regex.Matcher
import java.util.regex.Pattern
public class App {
public static void main(String[] args) throws IOException {
try (FileReader fileReader = new FileReader(new File("OutFile.txt"))
BufferedReader reader = new BufferedReader(fileReader)) {
String line = ""
Pattern pattern = Pattern.compile("Value at: \\d+ = (\\d+)")
while ((line = reader.readLine()) != null) {
Matcher matcher = pattern.matcher(line)
if (matcher.find()) {
int val = Integer.parseInt(matcher.group(1))
System.out.println(val)
}
}
}
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)