Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.00 KB | None | 0 0
  1. /*
  2.     system::strCheck:
  3.         Check if the strings ('s_' and '_s') match each other.
  4.  
  5.     Arguments:
  6.         s_[]        First string.
  7.         _s[]        Second string.
  8.    (op) bool:ic     ignorecase. (default: true)
  9.  
  10.     Returns:
  11.         ? False, True.
  12.  
  13.     Notes:
  14.         Similar to strcmp, but faster.
  15.         ignorecase -> When set to true, the case doesn't matter - HeLLo is the same as Hello. When false, they're not the same.
  16. */
  17. stock
  18.     system::strCheck(s_[], _s[], bool:ic = true)
  19. {
  20.     new
  21.             c = 0
  22.           , bool:b = true
  23.     ;
  24.     while (max(strlen(s_), strlen(_s)) != c)
  25.     {
  26.         if(ic)
  27.         {
  28.             _s[c] = (
  29.                      s_[c] >= 0b1100001 && s_[c] <= 0b1111010 ||
  30.                      _s[c] >= 0b1100001 && _s[c] <= 0b1111010 ||
  31.                      s_[c] >= 0b1000001 && s_[c] <= 0b1011010 ||
  32.                      _s[c] >= 0b1000001 && _s[c] <= 0b1011010
  33.                     )
  34.                     ? (s_[c]) : _s[c]
  35.             ;
  36.         }
  37.         if (s_[c] != _s[c])
  38.         {
  39.             b
  40.                 = false
  41.             ;
  42.         }
  43.         ++
  44.             c
  45.         ;
  46.     }
  47.     if (b)
  48.     {
  49.         return true;
  50.     }
  51.     else
  52.     {
  53.         return false;
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement