A question about ISS use

I need to split up a data file that is a database of names, job title and the like into separate lines,and the problem is that the job titles have spaces in their descriptions. I was wondering if there is a way for iss to accept multile spaces as the parameter to break a line. Currently I have this
1
2
3
4
5
6
7
8
9
 istringstream iss;
			iss.str(names);
			do
					{
						string sub;
						iss >>sub;
						file2 << sub <<endl;
					}
					while (iss);

and the problem is it has each word of the job title (all of which are variable lengths) as a separate line. Any Ideas?
Please post some samples of your input.
You could use std::istream::get() to extract the input character-by-character and write code that detects two (and more than two) consecutive spaces - then just make it do what you want it to do.
Last edited on
I can not post actual data obviously, but here is what the thing gernerally looks like

last_name (some spaces) first_name (lots of space) department (some spaces) job (some spaces) phone (a few spaces) id#,

pretty much, I just need it to take two spaces instead of one to break the line
Last edited on
I can not post actual data obviously,

The post some data that has the names changed to protect the innocent. But without being able to see exactly how the fields are separated you're asking use to guess about how to parse that string.

How are you getting your input? Is there a delimiter character, a tab char for example, that separates the fields? If not can you alter the data generator to provide some kind of field delimiter?


There is no tab character, the space length is non standard. It is an excel file I have been tasked to add new data to an reformat to no longer include the department.The person before me thought it would be a good plan to just put all the data in one column separated by a few spaces.
It is an excel file


The person before me thought it would be a good plan to just put all the data in one column separated by a few spaces.

Does this mean that the Excel file has all the information in one giant cell?

Do the fields appear to contain a fixed number of spaces?

This is really why seeing the actual input would be beneficial. Even if you have to manually 'x' out the actual data.
Last edited on
I did use bheadmaster's suggestion, but due to bad formatting of the original (always blame the person before you) it was actually more useful to just use my program and edit out the bad data by hand. Thank you all for the help though.
Topic archived. No new replies allowed.