c++ - QString - parsing QString with geoordinates -


i work in qt creator (community) 5.5.1. example, have

string="44° 36' 14.2\" n, 33° 30' 58.6\" e, 0m"

of qstring. know, must parse it, don't know how, because have never faced problem it. our string want other smaller strings:

cgt = "44"; cmt = "36"; cst = "14.2"

cgg = "33"; cmg = "30"; csg = "58.6"

what must working programm how said?
need real code. thanks.

"i need code" not kind of question should asking, "gimme knowledge" not "do work" questions. question should demonstrate effort solve problem, people can tell doing wrong. not question lack such effort, didn't expend when devopia did half of work you. keep in mind future questions.

struct g {     double cgt, cmt, cst, cgg, cmg, csg; };  g parse(qstring s) {     qstringlist list = s.split(qregexp("[^0-9.]"), qstring::skipemptyparts);     g g;     g.cgt = list.at(0).todouble();     g.cmt = list.at(1).todouble();     g.cst = list.at(2).todouble();     g.cgg = list.at(3).todouble();     g.cmg = list.at(4).todouble();     g.csg = list.at(5).todouble();     return g; } 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -