Advertisement
Guest User

Untitled

a guest
May 22nd, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. QString GeneralWindow::invertMessage(QString &text)
  2. {
  3.     QString tableR=tr("qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?");
  4.     QString tableE="qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?";
  5.     QString txt = text;
  6.     for(int i = 0; i < txt.length(); i++)
  7.     {
  8.         if(txt.at(i) <= QChar('z'))
  9.         {
  10.             int j = 0; bool b=true;
  11.         while((j < tableE.length()) && b)
  12.         {
  13.             if(txt[i] == tableE[j])
  14.             {
  15.                b = false;
  16.                txt[i] = tableR[j];
  17.             }
  18.             j++;
  19.          }
  20.           }else{
  21.          int j = 0; bool b = true;
  22.          while((j < tableR.length()) && b)
  23.          {
  24.             if(txt[i] == tableR[j])
  25.             {
  26.                b = false;
  27.                txt[i] = tableE[j];
  28.             }
  29.             j++;
  30.          }
  31.           }
  32.        }
  33.        return txt;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement