ZoriaRPG

Q*Bert Cuss String Replacement

Feb 27th, 2020
132
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Char array
  2. void qbertcuss(char *s, int len)
  3. {
  4.     for ( in q = 0; q < len; ++q )
  5.     {
  6.         if ( !s[q] ) return; // exit on null char if it is sooner than 'len'
  7.         switch( s[q] )
  8.         {
  9.             case 'a':
  10.             case 'e':
  11.             case 'i':
  12.             case 'o':
  13.             case 'u':
  14.             case 'A':
  15.             case 'E':
  16.             case 'I':
  17.             case 'O':
  18.             case 'U':
  19.                 s[q] = '*'; break;
  20.             default: break;
  21.         }
  22.     }
  23. }
  24.  
  25. // std::string
  26. void qbertcuss(std::string *s)
  27. {
  28.     for ( int q = 0; q <= s->size(); ++q )
  29.     {
  30.         switch( s[q] )
  31.         {
  32.             case 'a':
  33.             case 'e':
  34.             case 'i':
  35.             case 'o':
  36.             case 'u':
  37.             case 'A':
  38.             case 'E':
  39.             case 'I':
  40.             case 'O':
  41.             case 'U':
  42.                 s[q] = '*'; break;
  43.             default: break;
  44.         }
  45.     }
  46. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×