java - Parsing .txt file line by line -
i trying parse .txt file. need @ file line line , access info enclosed ''. here have tried far:
public static void main(string[] args) { string[] test; string word; scanner inputstream = null; seek { inputstream = new scanner(new fileinputstream("stuff.txt")); } catch(filenotfoundexception e) { system.out.println("output.txt not found, or not opened"); } while(inputstream.hasnextline()) { word = inputstream.nextline(); test = word.split("['']"); for(int = 0; < test.length; i++) { system.out.println(test[i]); } } }
and here format of input file:
type = 'home' title = 'please work' start = '2000, september, 10, 10, 10' end = '2010, october, 20, 20, 20' comment = 'please word '
i need access type, title, comment, , individual values in start , end
that file looks property file, can consider utilize format of file.
also, should splut using '=' instead brackets.
java file parsing file-io
No comments:
Post a Comment