-
when to use a class
Okay,
I have a function written that will read a file and output the file with the length of each line. I want to parse each line until I get a specific character, then continue to read the line until the end of the line.
I have each line when used, stored in a string. Should I try to implement a class to parse the string? Or is there an easier way to do this???
Thanks
-
I suppose you could use a class to hide the "tokenize" part. class FileLine or something. Sure, why not.
-
let me try again
Let's see:
What I really want to do is to make a new file that will have the previous character string on the left side or the "token". Next I want to continue to read the same string. Next, I want to break the right side into smaller parts between white space characters and print a new line with the left side, token, right side.
Example:
Input file:
------------
12 ? a g e
This is my desired output:
--------------------------------
12 ? a
12 ? g
12 ? e
Thanks