diff options
author | Mike Buland <eichlan@xagasoft.com> | 2010-03-01 23:35:57 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2010-03-01 23:35:57 +0000 |
commit | 54ddc589e3d803a4ceddf6b5a784ff85a94421ec (patch) | |
tree | 0510361798e7616dbb1fe9f8c253e6678c5b1baa | |
parent | 445392690213686759254556c4a6ae0fe70765bd (diff) | |
download | libbu++-54ddc589e3d803a4ceddf6b5a784ff85a94421ec.tar.gz libbu++-54ddc589e3d803a4ceddf6b5a784ff85a94421ec.tar.bz2 libbu++-54ddc589e3d803a4ceddf6b5a784ff85a94421ec.tar.xz libbu++-54ddc589e3d803a4ceddf6b5a784ff85a94421ec.zip |
The CSV Reader now handles multiple comma characters in sequence without spaces
correctly.
-rw-r--r-- | src/csvreader.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/csvreader.cpp b/src/csvreader.cpp index 1f623fa..b045773 100644 --- a/src/csvreader.cpp +++ b/src/csvreader.cpp | |||
@@ -43,14 +43,22 @@ Bu::StrArray Bu::CsvReader::readLine() | |||
43 | 43 | ||
44 | Bu::FString sLine = sIn.readLine(); | 44 | Bu::FString sLine = sIn.readLine(); |
45 | 45 | ||
46 | for( Bu::FString::iterator i = sLine.begin(); i; i++ ) | 46 | Bu::FString::iterator i = sLine.begin(); |
47 | |||
48 | aVals.append( sDecode( i ) ); | ||
49 | |||
50 | while( i ) | ||
47 | { | 51 | { |
48 | if( *i == ',' ) | 52 | if( *i == ',' ) |
49 | { | 53 | { |
54 | i++; | ||
55 | aVals.append( sDecode( i ) ); | ||
50 | } | 56 | } |
51 | else | 57 | else |
52 | { | 58 | { |
53 | aVals.append( sDecode( i ) ); | 59 | // Blanks and stuff? |
60 | sio << "Out of bound: '" << *i << "'" << sio.nl; | ||
61 | i++; | ||
54 | } | 62 | } |
55 | } | 63 | } |
56 | 64 | ||