daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Jan 18th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Stringa operator -(Stringa s1, Stringa s2){
  2.     int l;
  3.     QString r;
  4.     if(s1.length() > s2.length())
  5.         l = s1.length();
  6.     else
  7.         l = s2.length();
  8.     for(int i = 0; i < l; i++){
  9.         char c1 = s1.charAt(i).toLatin1();
  10.         char c2 = s2.charAt(i).toLatin1();
  11.         int ascii1 = static_cast<int>(c1);
  12.         int ascii2 = static_cast<int>(c2);
  13.         int ascii = ascii1-ascii2;
  14.         if(ascii<0) ascii +=126;
  15.         if(ascii < 32 || ascii == 127)
  16.             ascii = 48;                     //exception: carattere non stampabile
  17.         char c = static_cast<char>(ascii);
  18.         r+=c;
  19.     }
  20.     return r;
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top