I hoping someone can give me an answer to a quick question.
I have a CSV text file to read. I'm able to get the values and manipulate them without a problem, but I don't how to handle something like:
...xxx.xx,xxx.xx,xx,x,xxx,,xxx,xx.xx,....
The 6th element (i.e. ",,") is giving me fits with how to handle it. In my specific situation, a ",," means the value is not present and should not be analyzed, I need to know its an empty value.
Can someone please suggest a way to read this line and check the for this empty value?
I don't see the problem. If you get your values by reading until the next comma (using getline, for example), you'll automatically get an empty string with that. You check whether a string is empty using the empty() member function.
I've been given one month of data and in that month, the empty ",," value hasn't appeared, but I have another 12 months of data coming and I'm sure it WILL appear at least once so I just need to check for the presence of the empty member and handle it accordingly.
Thank you. I had not considered the empty() function. I think your answer will help.