diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-01-22 21:08:25 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-01-22 21:08:25 +0000 |
commit | a41a8d21e9f7fde7c69c1748a76c9058b58ebaf3 (patch) | |
tree | b99d33ba81331df03acd369898f34d49d0bd2a84 /src/csvwriter.cpp | |
parent | 38d72457609b56c1b0f8e82d719e44f9906fe9c0 (diff) | |
download | libbu++-a41a8d21e9f7fde7c69c1748a76c9058b58ebaf3.tar.gz libbu++-a41a8d21e9f7fde7c69c1748a76c9058b58ebaf3.tar.bz2 libbu++-a41a8d21e9f7fde7c69c1748a76c9058b58ebaf3.tar.xz libbu++-a41a8d21e9f7fde7c69c1748a76c9058b58ebaf3.zip |
Minor change to csvwriter, the excel formatter wasn't escaping strings with
commas or quotes quite right, it's much better now. Also, added an SHA1 unit
test.
Diffstat (limited to '')
-rw-r--r-- | src/csvwriter.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/csvwriter.cpp b/src/csvwriter.cpp index 58437b8..d8910aa 100644 --- a/src/csvwriter.cpp +++ b/src/csvwriter.cpp | |||
@@ -50,7 +50,7 @@ void Bu::CsvWriter::writeLine( const StrArray &aStrs ) | |||
50 | 50 | ||
51 | Bu::String Bu::CsvWriter::encodeExcel( const Bu::String &sIn ) | 51 | Bu::String Bu::CsvWriter::encodeExcel( const Bu::String &sIn ) |
52 | { | 52 | { |
53 | if( sIn.find('\"') ) | 53 | if( sIn.find('\"') || sIn.find(',') ) |
54 | { | 54 | { |
55 | Bu::String sOut = "\""; | 55 | Bu::String sOut = "\""; |
56 | for( Bu::String::const_iterator i = sIn.begin(); i; i++ ) | 56 | for( Bu::String::const_iterator i = sIn.begin(); i; i++ ) |
@@ -60,6 +60,7 @@ Bu::String Bu::CsvWriter::encodeExcel( const Bu::String &sIn ) | |||
60 | else | 60 | else |
61 | sOut += *i; | 61 | sOut += *i; |
62 | } | 62 | } |
63 | sOut += '\"'; | ||
63 | return sOut; | 64 | return sOut; |
64 | } | 65 | } |
65 | return sIn; | 66 | return sIn; |