Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 15th, 2012  |  syntax: None  |  size: 0.93 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. bool Contains(const char MyChar[], const int MyCharSize, const char Search[], const int SearchSize)
  2. {
  3.     int LoopOne = 0;
  4.     int LoopTwo = 0;
  5.     int LoopThree = 0;
  6.     int Yes = 0;
  7.    
  8.     while(LoopOne < MyCharSize)
  9.     {
  10.    
  11.         if(MyChar[LoopOne] == Search[0])
  12.         {
  13.             LoopTwo = 0;
  14.             LoopThree = LoopOne;
  15.             while(LoopTwo < SearchSize)
  16.             {
  17.                
  18.                 if(MyChar[LoopThree] == Search[LoopTwo])
  19.                 {
  20.                     Yes++;          
  21.                     LoopTwo++;
  22.                     LoopThree++;
  23.                 }
  24.                 else
  25.                 {
  26.                     Yes = 0;
  27.                     break;          //if char does not match
  28.                 }
  29.             }
  30.             if(Yes == SearchSize)
  31.             {
  32.                 return true;
  33.             }
  34.         }
  35.         LoopOne++;
  36.     }
  37.     return false;
  38. }