Advertisement
jhei13

NamingVariable_ALGORI/001

Jul 21st, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1.  Console.Write("Input a String : ");
  2.             string variable = Console.ReadLine();
  3.             char[] ch = variable.ToCharArray();
  4.  
  5.  
  6.             if (!(ch[0] < 47 || ch[0] > 58))
  7.             {
  8.                 Console.Write("Kindly Check because first character won't accept Space \n nor Digit or Special Character. \n THANK YOU");
  9.             }
  10.  
  11.             else
  12.             {
  13.                 foreach (char cha in variable)
  14.                 {
  15.                     Convert.ToInt32(cha);
  16.                     if ((!(cha < 64 || cha > 90) || !(cha < 97 || cha > 122) || !(cha < 48 || cha > 57) || (cha == 95)))
  17.                     {
  18.                        
  19.                     }
  20.                     else
  21.                     {
  22.                        Console.WriteLine(cha + " is an invalid character\n Whole string  will be Invalid");
  23.                         Console.ReadLine();
  24.                         return;
  25.                     }
  26.  
  27.                 }
  28.                
  29.                 Console.WriteLine("Variable string is VALID");
  30.             }
  31.             Console.ReadLine();
  32.             }
  33.             //coded by : ACT
  34.         }
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement