java de tokenizador de cadena
/*
> Reads from a text file, in this example it's reading from read.txt
> Prints each token in the output
*/
import java.util.*;
import java.io.*;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.FileReader;
public class Tokens {
public static void main(String[]args){
try{
FileReader read = new FileReader("read.txt");
BufferedReader readFile = new BufferedReader(read);
String line;
while((line = readFile.readLine()) != null){
String[] tokens = line.split(" ");
for(String token : tokens){
System.out.println(token);
}
}
readFile.close();
}
catch(IOException e){
System.out.println("Error");
}
}
}
painfulcode