Advertisement
Guest User

Stringf.inc by jCause

a guest
Apr 15th, 2014
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.43 KB | None | 0 0
  1. /*
  2.  
  3.     - StringFunctions -
  4.         by: jCause
  5.         date: 2014
  6.         Version: 1.0
  7.  
  8.     Funkcijos:
  9.  
  10.     - GetSymbolRowNumber( const e_symbol[], const e_string[] )
  11.     - IsSymbolInString( const e_symbol[], const e_string[] )
  12.     - IsStringEmpty( const e_string[] )
  13.     - IsStringSize( const e_string[], const e_size )
  14.     - IsStringInArray(const e_string[], const e_array[][], const e_array_size = sizeof e_array)
  15.  
  16. */
  17.  
  18. stock GetSymbolRowNumber( const e_symbol[], const e_string[] )
  19. {
  20.     for( new stringLoop; stringLoop < strlen(e_string); stringLoop++ )
  21.     {
  22.         if( !strcmp(e_string[stringLoop], e_symbol, true) )
  23.         {
  24.             return stringLoop;
  25.         }
  26.     }
  27.     return -1;
  28. }
  29.  
  30. stock IsSymbolInString( const e_symbol[], const e_string[] )
  31. {
  32.     for( new stringLoop; stringLoop < strlen(e_string); stringLoop++ )
  33.     {
  34.         if( !strcmp(e_string[stringLoop], e_symbol, true) )
  35.         {
  36.             return(true);
  37.         }
  38.     }
  39.     return(false);
  40. }
  41.  
  42. stock IsStringEmpty( const e_string[] )
  43. {
  44.     if( strlen(e_string) == 0 )
  45.     {
  46.         return(true);
  47.     }
  48.     else
  49.         return(false);
  50. }
  51.  
  52. stock IsStringSize( const e_string[], const e_size )
  53. {
  54.     if( strlen(e_string) == e_size )
  55.     {
  56.         return(true);
  57.     }
  58.     else
  59.         return(false);
  60. }
  61.  
  62. stock bool:IsStringInArray(const e_string[], const e_array[][], const e_array_size = sizeof e_array)
  63. {
  64.     new e_string_row = 0;
  65.     while(e_string_row < e_array_size)
  66.     {
  67.         if(!strcmp(e_string, e_array[e_string_row], true))
  68.         {
  69.             return true;
  70.         }
  71.  
  72.         ++e_string_row;
  73.     }
  74.     return false;
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement