SHARE
TWEET

IsAlphabetical

kyrathasoft May 20th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public static bool IsAlphabetical(string p)
  2.     {
  3.         /*returns true if every character in the passed
  4.         argument is either a lower- or upper-case letter
  5.         of the English alphabet; false otherwise */
  6.        
  7.         bool result = true;
  8.        
  9.         byte[] word = StringToByteArray(p);
  10.         foreach(byte b in word)
  11.         {
  12.             if(b < 65)
  13.             {
  14.                 return false;
  15.             }else{
  16.                 if (b > 122){
  17.                     return false;
  18.                 }else{
  19.                     if((b > 90) && (b < 97)){
  20.                         return false;
  21.                     }
  22.                 }
  23.             }
  24.            
  25.         }
  26.        
  27.         return result;
  28.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top