Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

string tokenizer java

/*
> 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");
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: java eclipse console clear 
Java :: Printing array list through for loop in java 
Java :: java remove last character 
Java :: java Write a program to reverse an array or string 
Java :: uuid from any string java 
Java :: milliseconds to seconds java 
Java :: discord jda 
Java :: java sleep 1 second 
Java :: how to find numbers of digits in java 
Java :: for each loop java 
Java :: android ask if system is in dark mode 
Java :: generate serial uuid with intelij 
Java :: android application class manifest 
Java :: react The href attribute is required for an anchor to be keyboard 
Java :: template competitive programming java 
Java :: if is true javascrtiptr 
Java :: connect sqlite for java 
Java :: AndroidManifest.xml could not be found. 
Java :: java string not equal 
Java :: fakultät in java 
Java :: java running sum of array 
Java :: java swing menu click event 
Java :: math.absolute java 
Java :: java convert double to int 
Java :: raise error java 
Java :: tomcat 9 default username and password 
Java :: gat environment variables java 
Java :: set view layout params android 
Java :: how to make a dictionary in java 
Java :: check each character in a string java 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =