Advertisement
garfield

[COD]: Contar caractere em string.

Oct 30th, 2012
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.42 KB | None | 0 0
  1.  
  2. public OnFilterScriptInit(){
  3.  
  4.     printf("Caracteres: %i", CountCharInString("Hello, This is, a, string", ','));
  5.     return true;
  6. }
  7.  
  8.  
  9. CountCharInString(string[], chara){
  10.     static
  11.         String_Char,
  12.         String_Size
  13.     ;
  14.    
  15.    
  16.     String_Char = 0;
  17.    
  18.     String_Size = strlen(string);
  19.    
  20.    
  21.     for( ; String_Size > -1; --String_Size){
  22.         if(string[String_Size] == chara){
  23.             String_Char ++;
  24.         }
  25.     }
  26.     return String_Char;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement