peoplecode

PeopleCode Check Number and Check Letter Functions

Couple PeopleCode functions I came across. One insures a string consists of numbers and one insures a string consists of letters.

Function Check_Number(&STR) Returns boolean;
   &LEN = Len(&STR);
   If &LEN = 0 Then
      Return False;
   End-If;
   For &I = 1 To &LEN;
      &CODE = Code(Substring(&STR, &I, 1));
      If (&CODE < 48 Or
            &CODE > 57) Then
         Return False;
      End-If;
   End-For;
   Return True;
End-Function;

Function Check_Letter(&STR) Returns boolean;
   &LEN = Len(&STR);
   If &LEN = 0 Then
      Return False;
   End-If;