Lenny

IsARolePlayName

Jul 19th, 2011
680
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.56 KB | None | 0 0
  1. stock IsARolePlayName(name[])
  2. {
  3.     new
  4.                 szLastCell,
  5.         bool:   bUnderScore;
  6.        
  7.     for(new i; i < strlen(name); i++)
  8.     {
  9.         if(name[i] == '_')
  10.         {
  11.             if(bUnderScore == true)
  12.             {
  13.                 return 0;
  14.             }
  15.            
  16.             bUnderScore = true;
  17.         }
  18.        
  19.         else if(!szLastCell || szLastCell == '_') // Check if capitalized where it should be
  20.         {
  21.             if(name[i] < 'A' || name[i] > 'Z')
  22.             {
  23.                 return 0;
  24.             }
  25.         }
  26.        
  27.         else
  28.         {
  29.             if(name[i] < 'a' || name[i] > 'z')
  30.                 return 0;
  31.         }
  32.        
  33.         szLastCell = name[i];
  34.     }
  35.    
  36.     if(bUnderScore == false)
  37.         return 0;
  38.        
  39.     return 1;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment