| 106 |
|
return -1; |
| 107 |
|
} |
| 108 |
|
|
| 109 |
< |
QStringList substring(const QString &myString,const QString &separator, Qt::CaseSensitivity cs){ |
| 110 |
< |
QStringList result = QStringList(); |
| 111 |
< |
int currIdx=0, nextIdx=0; |
| 112 |
< |
|
| 113 |
< |
while(true){ |
| 114 |
< |
nextIdx=myString.indexOf(separator,currIdx,cs); |
| 115 |
< |
result << myString.mid(currIdx,nextIdx-currIdx); |
| 116 |
< |
if(nextIdx==-1) break; |
| 117 |
< |
currIdx=nextIdx+1; |
| 118 |
< |
} |
| 109 |
> |
// Use qstring split |
| 110 |
> |
//QStringList substring(const QString &myString,const QString &separator, Qt::CaseSensitivity cs){ |
| 111 |
> |
// QStringList result = QStringList(); |
| 112 |
> |
// int currIdx=0, nextIdx=0; |
| 113 |
> |
|
| 114 |
> |
// while(true){ |
| 115 |
> |
// nextIdx=myString.indexOf(separator,currIdx,cs); |
| 116 |
> |
// result << myString.mid(currIdx,nextIdx-currIdx); |
| 117 |
> |
// if(nextIdx==-1) break; |
| 118 |
> |
// currIdx=nextIdx+1; |
| 119 |
> |
// } |
| 120 |
|
|
| 121 |
< |
return result; |
| 122 |
< |
} |
| 121 |
> |
// return result; |
| 122 |
> |
//} |
| 123 |
|
|
| 124 |
|
QStringList qStringListFromSpacedString(const QString &mySpacedString){ |
| 125 |
< |
return Util::substring(mySpacedString," "); |
| 125 |
> |
return mySpacedString.split(" "); |
| 126 |
|
} |
| 127 |
|
|
| 128 |
|
QList<int> qListIntFromSpacedString(const QString &mySpacedString){ |
| 129 |
|
QStringList stringList; |
| 130 |
|
QList<int> intList; |
| 131 |
|
|
| 132 |
< |
stringList = Util::substring(mySpacedString," "); |
| 132 |
> |
stringList = mySpacedString.split(" "); |
| 133 |
|
|
| 134 |
|
foreach(QString value, stringList){ |
| 135 |
|
intList << value.toInt(); |
| 142 |
|
QStringList stringList; |
| 143 |
|
QList<double> doubleList; |
| 144 |
|
|
| 145 |
< |
stringList = Util::substring(mySpacedString," "); |
| 145 |
> |
stringList = mySpacedString.split(" "); |
| 146 |
|
|
| 147 |
|
foreach(QString value, stringList){ |
| 148 |
|
doubleList << value.toDouble(); |