Is there a way to increment a QString in C++- something like:
QString str("a");
str++;
qDebug()<<a; //Here i want letter "b"
EDIT: Yes, basically i want to increment a one letter but incrementing longer string would be good.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t really increment a string because you would first have to define how that would work. For example, where would the values wrap arround.
You can increment the characters though, but even this will only work for meaningful character sequences:
str[0].unicode()++;EDIT: reaction OP comments
If you just want to switch between scenarios, this is the code you wan to use: