From f10fe5ad6bc561f05fcace7bb278e2a50c906208 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 30 Oct 2022 20:35:28 +0100 Subject: use qt built-in trailing newline split solution --- client/HandleMessage.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'client') diff --git a/client/HandleMessage.cpp b/client/HandleMessage.cpp index 84f561b..d719157 100644 --- a/client/HandleMessage.cpp +++ b/client/HandleMessage.cpp @@ -24,9 +24,8 @@ void HandleMessage::ParseToSQL(QString input) { QSqlQuery queryInsertData; QString output = "INSERT INTO `tblMain` (`temperature`, `humidity`, `pressure`) VALUES "; QStringList data; - QStringList list = input.split("\n"); + QStringList list = input.split("\n",Qt::SkipEmptyParts); for (int i = 0; i < list.size(); ++i) { - if (list[i].size() == 0) continue; data=list[i].split(","); bool valid; @@ -44,5 +43,3 @@ void HandleMessage::ParseToSQL(QString input) { queryInsertData.exec(output); } - - -- cgit v1.2.3