Check Input Character - Pascal
<p>I'm trying to write a block of code that's going to allow me to validate an alphanumeric ID number containing upper and lower case letters along with digits.</p>

<p>Since its of fixed size, I have no issues isolating each part (i.e the Uppercase part, lowercase part and numeric part to be checked separately) but I'm having issues with checking for upper and lower case letters.</p>

<p>I've read up on the <code>IsUpper</code> and <code>IsLower</code> functions but I'm having difficulty in implementing it in my program. Is this the most efficient way to go or is there an easier route?</p>

<p>I'm using Pascal (Free Pascal IDE) and a sample input to be validated would be <code>Abc123</code>.</p>

<p>Thanks!</p>

<p>EDIT : </p>

<pre><code>Program CheckChar;

VAR
UserID, LCase, UCase, Num : String;
readkey : char;
L  : Integer;


CONST
Upper = ['A'..'Z'];
Lower = ['a'..'z'];
 Int   = ['0'..'9'];

Begin
Write('Enter UserID ');Readln(UserID);
Ucase := Copy(UserID,1,1);
LCase := Copy(UserID,2,1);
Num   := Copy(UserID,3,2);
L     := Length(UserID);

  While L = 6 Do
  Begin
    IF not (Ucase in Upper) or (Lcase in Lower) or (Num in Int) then
    Begin
 Writeln('Invalid Input');
 End;
Else
 Writeln('Valid Input');
 Else
  Writeln('Invalid Length);

  End;

 readln(readkey);
  End.
</code></pre>