代码改变世界

Using java.util.Scanner to process line-based strings or files

2011-02-22 14:31  RayLee  阅读(233)  评论(0编辑  收藏  举报

Scanner scanner  = new Scanner(file or string);

while (scanner.hasNextLine()) {

    processLine(scanner.nextLine());

}

You can do more than that using Scanner. See details in Java API documentations.