Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- QString GeneralWindow::invertMessage(QString &text)
- {
- QString tableR=tr("qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?");
- QString tableE="qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?";
- QString txt = text;
- for(int i = 0; i < txt.length(); i++)
- {
- if(txt.at(i) <= QChar('z'))
- {
- int j = 0; bool b=true;
- while((j < tableE.length()) && b)
- {
- if(txt[i] == tableE[j])
- {
- b = false;
- txt[i] = tableR[j];
- }
- j++;
- }
- }else{
- int j = 0; bool b = true;
- while((j < tableR.length()) && b)
- {
- if(txt[i] == tableR[j])
- {
- b = false;
- txt[i] = tableE[j];
- }
- j++;
- }
- }
- }
- return txt;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement