Skip to content

Commit

Permalink
Refactor header content generation to use a static regular expression…
Browse files Browse the repository at this point in the history
… for improved performance and readability.
  • Loading branch information
przemek83 committed Jan 4, 2025
1 parent 3abe6ec commit c3577f4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/ExportXlsx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@ QByteArray ExportXlsx::generateHeaderContent(const QAbstractItemModel& model)
for (int j{0}; j < columnCount; ++j)
{
QString header{model.headerData(j, Qt::Horizontal).toString()};
static const QRegularExpression regExp{QStringLiteral("[<>&\"']")};
const QString clearedHeader(
header
.replace(QRegularExpression(QStringLiteral("[<>&\"']")),
QStringLiteral(" "))
header.replace(regExp, QStringLiteral(" "))
.replace(QStringLiteral("\r\n"), QStringLiteral(" ")));
headersContent.append("<c r=\"" + columnNames_[j]);
headersContent.append(R"(1" t="str" s="6"><v>)" +
Expand Down

0 comments on commit c3577f4

Please sign in to comment.