Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!bcstec!galileo!rfh3273 From: rfh3273@galileo.rtn.ca.boeing.com (Dick Harrigill) Newsgroups: comp.lang.pascal Subject: Upcase (was: What's wrong with this) Message-ID: <379@galileo.rtn.ca.boeing.com> Date: 8 May 91 16:55:24 GMT References: <1991Apr20.011454.25016@javelin.sim.es.com> <1991May02.191410.23984@eve.wright.edu> Organization: be30r Lines: 26 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