Qt Swap numbers places in text
-
Hi,
I have a text documents .İt has numbers that 1234 and ı want to change their places like 2143 how can ı change it ?
İt was a big problem please help me . -
You can use std::reverse:
QString numbers{QLatin1String("1234")}; std::reverse(numbers.begin(),numbers.end()); qDebug() << numbers;
-
You can use std::reverse:
QString numbers{QLatin1String("1234")}; std::reverse(numbers.begin(),numbers.end()); qDebug() << numbers;
@VRonin Thank you , but numbers are in text documents and ı dont want to paste them in qt .I want to display them in text edit or something coould you write all code ?
-
You can use std::reverse:
QString numbers{QLatin1String("1234")}; std::reverse(numbers.begin(),numbers.end()); qDebug() << numbers;
-
@VRonin Thank you , but numbers are in text documents and ı dont want to paste them in qt .I want to display them in text edit or something coould you write all code ?
@BORHAN-CO. said in Qt Swap numbers places in text:
but numbers are in text documents
How your documents are formatted ?
like this?// doc.txt
"1234" "1234" "1234" "1234"
-
std::reverse(numbers.begin(),numbers.end()-2); std::reverse(numbers.begin()+2,numbers.end());
@LeLev
Many thanks for your answer ı solved it with your help :)