njunwa1
29th April 2017, 22:55
I have CSV file of servers separate by \r\n with unwanted word *serverlist" at the beginning of the file and unwanted "*" at the end.
*serverlist\r\n#HostName,IP,Score,Ping,Speed,Count ryLong,CountryShort\r\nserver2x.selfip.xx,111.100. 240.10,605268,8,380099315,Japan,JP\r\nserve2x.self ip.xx,39.110.61.222,602280,3,625856265,Japan,JP\r\ nserver2x.selfip.xx,46.5.0.129,400121,15,15754028, Germany,DE\r\n*\r\n
Am downloading this from a remote server using QNetworkAccessManager and QNetworkReply
QString csvdata(reply->readAll());
QStringList srvlist;
for(QString data : csvdata.replace("\r","").split("\n")){
srvlist =data.split(',');
//Having Got a First List in the Firts Iteration,How Can I get each item in the list? so as I can send it to my Database table using below Sql query
// INSERT INTO serverlisttable (id, hostname, IP,score...) VALUES (1, 'listitem at [0]', 'list item at [1]'...)
}
My Goal is to Store this type of Data by Group into a Database in this Format for easy searching
ID HostName IP Score Ping Speed CountryLong CountryShort
1 server2x.selfip.xx 111.100.240.10 605268 8 380099315 Japan JP
2 serve2x.selfip.xx 39.110.61.222 602280 3 625856265 Japan JP
Your help will be appreciated
*serverlist\r\n#HostName,IP,Score,Ping,Speed,Count ryLong,CountryShort\r\nserver2x.selfip.xx,111.100. 240.10,605268,8,380099315,Japan,JP\r\nserve2x.self ip.xx,39.110.61.222,602280,3,625856265,Japan,JP\r\ nserver2x.selfip.xx,46.5.0.129,400121,15,15754028, Germany,DE\r\n*\r\n
Am downloading this from a remote server using QNetworkAccessManager and QNetworkReply
QString csvdata(reply->readAll());
QStringList srvlist;
for(QString data : csvdata.replace("\r","").split("\n")){
srvlist =data.split(',');
//Having Got a First List in the Firts Iteration,How Can I get each item in the list? so as I can send it to my Database table using below Sql query
// INSERT INTO serverlisttable (id, hostname, IP,score...) VALUES (1, 'listitem at [0]', 'list item at [1]'...)
}
My Goal is to Store this type of Data by Group into a Database in this Format for easy searching
ID HostName IP Score Ping Speed CountryLong CountryShort
1 server2x.selfip.xx 111.100.240.10 605268 8 380099315 Japan JP
2 serve2x.selfip.xx 39.110.61.222 602280 3 625856265 Japan JP
Your help will be appreciated