c++ - Editing the file in Qt -
let's have .csv file follows:
1,2,5,5, 0,5,6,9, 3,2,5,7, 1,2,3,6, how can delete ',' sign @ end of each line?
p.s. example know how clean space @ end of line - file.readline().trimmed();, how same other signs, have no idea.
assuming know how read line line, crude method works:
qstring teststr = qstring("1,2,5,5,"); qstringlist testlist = teststr.split(","); qdebug() << "testlist" << testlist; testlist.removelast(); qdebug() << "testlist" << testlist; teststr = testlist.join(","); qdebug() << "teststr" << teststr; // output
testlist ("1", "2", "5", "5", "") testlist ("1", "2", "5", "5") teststr "1,2,5,5"
Comments
Post a Comment