Mercurial > hg > svcore
comparison base/StringBits.h @ 1833:21c792334c2e sensible-delimited-data-strings
Rewrite all the DelimitedDataString stuff so as to return vectors of individual cell strings rather than having the classes add the delimiters themselves. Rename accordingly to names based on StringExport. Take advantage of this in the CSV writer code so as to properly quote cells that contain delimiter characters.
author | Chris Cannam |
---|---|
date | Fri, 03 Apr 2020 17:11:05 +0100 |
parents | 64ef24ebb19c |
children | 91056142abd0 |
comparison
equal
deleted
inserted
replaced
1832:7c92c644db20 | 1833:21c792334c2e |
---|---|
53 * false, use QString::split; if separator is ' ', use | 53 * false, use QString::split; if separator is ' ', use |
54 * SkipEmptyParts behaviour, otherwise use KeepEmptyParts (this is | 54 * SkipEmptyParts behaviour, otherwise use KeepEmptyParts (this is |
55 * analogous to the behaviour of splitQuoted). | 55 * analogous to the behaviour of splitQuoted). |
56 */ | 56 */ |
57 static QStringList split(QString s, QChar separator, bool quoted); | 57 static QStringList split(QString s, QChar separator, bool quoted); |
58 | |
59 /** | |
60 * Join a vector of strings into a single string, with the | |
61 * delimiter as the joining string. If a string contains the | |
62 * delimiter already, quote it with double-quotes, replacing any | |
63 * existing double-quotes within it by a pair of double-quotes, as | |
64 * specified in RFC 4180 Common Format and MIME Type for | |
65 * Comma-Separated Values (CSV) Files. | |
66 */ | |
67 static QString joinDelimited(QVector<QString> row, QString delimiter); | |
58 }; | 68 }; |
59 | 69 |
60 #endif | 70 #endif |