Mercurial > clickerconvert
diff src/converter.cpp @ 43:f9a0b2b6832e
Sanitize input and unify Lineendings
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 12 May 2016 17:35:49 +0200 |
parents | f6c53e896008 |
children | aaaf8cdbc85c |
line wrap: on
line diff
--- a/src/converter.cpp Fri Apr 15 15:36:49 2016 +0200 +++ b/src/converter.cpp Thu May 12 17:35:49 2016 +0200 @@ -174,13 +174,17 @@ xlsx.mergeCells("A1:C1"); xlsx.setRowHeight(1, TITLE_ROW_HEIGHT); - const QString input = instream.readAll(); + QString input = instream.readAll(); QRegularExpression questionEx(QUESTION_PATTERN); QRegularExpression choiceEx(CHOICE_PATTERN); QRegularExpression choiceAltEx(CHOICE_UNFILLED_PATTERN); QRegularExpression freetxtEx(FREETXT_PATTERN); + input.replace("\r\n", "\n"); + input.replace("\n\r", "\n"); + input.replace("#NAME?\n", ""); + QRegularExpressionMatch match = questionEx.match(input); bool foundSomething = false; int cursor = match.capturedEnd();