This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

parsing an input file  RSS feed

 
Stephanie Lee
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have an input file that has a series of numbers and letters in rows like this:
56 ee 34 10 22 cb 1c
56 ee 60 01 f0 70 7e
...
...
... etc.
i want to take each number to categorize and compare it to something else. each number meaning '56','ee','34', etc. and then write the entire file to an output file. what is the best way to do this? using a StringTokenizer? or StreamTokenizer? any help is much appreciated.
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
StringTokenizer seems like a safe bet for me. Grab each line as a String, pass it to the tokenizer and iterate over the characters, doing whatever processing needs to be done. Not sure how much more optimized you could get without sacrificing simplicity.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!