Advertisement
garfield

[COD]: Verificar uma string numérica.

Jan 22nd, 2012
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.41 KB | None | 0 0
  1. /*
  2.         @Função: Verificar se uma string é numérica
  3.         @Créditos: [iPs]SuYaNw
  4. */
  5.  
  6.  
  7. stock IsNumeric(al[])
  8. {
  9.     if(strlen(al) <= 1) return false;
  10.     new size = strlen(al);
  11.     for(new i = 0; i != size; i++)
  12.     {
  13.         if('9' >= (al[i]) <= '0')
  14.         {
  15.             return true;
  16.         }
  17.     }
  18.     return false;
  19. }
  20.  
  21.  
  22.  
  23. // Uso:
  24.  
  25. if(IsNumeric(myString))
  26. {
  27.     print("ela é numerica");
  28. }
  29. else
  30. {
  31.     print("ela não é numérica");
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement