[comp.lang.pascal] Upcase

rfh3273@galileo.rtn.ca.boeing.com (Dick Harrigill) (05/08/91)

In article <1991Apr20.011454.25016@javelin.sim.es.com> tpehrson@javelin.sim.es.com writes:
>why doesn't this work:
>function upper(I:string):string;
> var z:integer; 
> begin
>  for z:=1 to length(I) do
>  if (ord(I[z])>96) and (ord(I[z])<123) then I[z]:=upcase(I[z]);
> end;

It has already been pointed out several times that the function
assignment was not made.

However, one thing I didn't see mentioned was the fact that the checking
( if (ord(I[z])>96) and (ord(I[z])<123) ... ) is totally unnecessary.
The TP upcase function already does the checking for you.  If the passed
character is not in the 'a'..'z' range it is not changed.

Therefore 
               for z:=1 to length(I) do 
                I[z]:=upcase(I[z]);
is sufficient.
-- 
Dick Harrigill, an independent voice from:     Boeing Commercial Airplanes 
M/S 9R-49  PO BOX 3707                       Renton Avionics/Flight Systems
Seattle, WA  91824                                  Computing Support
(206) 393-9539     rfh3273@galileo.rtn.ca.boeing.com