Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uunet!orca!javelin.sim.es.com!tpehrson From: tpehrson@javelin.sim.es.com (Tim Clinkenpeel) Newsgroups: comp.lang.pascal Subject: Help me (problems with strings) Message-ID: <1991Apr18.020517.7767@javelin.sim.es.com> Date: 18 Apr 91 02:05:17 GMT Reply-To: tpehrson@javelin.sim.es.com Organization: Evans & Sutherland Computer Corp., Salt Lake City, Utah Lines: 38 I'm getting the error "Type mismatch" in the following: Procedure writ(txt:string); var huh:char; begin; for x:=1 to length(txt) do begin huh:=copy(txt,x,1); <---error occurs here case huh of '[' : red; ']' : rx; else write(huh); end; writeln; end; end; this is contrary to the FINE (sarcastic) book i have, _Turbo_Pascal_Trilogy_, which states: "...Data can be moved into a char variable using several methods. The assignments can be made using the assign (:=) operation with a function such as Chr(), single character extractions from strings of characters, or..." ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ is there another way to do a single character extraction from a string that i am overlooking or is the text wrong? i also tried modifying by having "huh" be an integer and changing the fifth line to "huh:=ord(copy(txt,x,1));" which results in the error "Ordinal expression expected". furthermore, i tried having "huh" be a string, which results in the same error, only on line 6 (between "huh" and "of" to be exact). If you can help me with this irksome problem, i would very much enjoy hearing from you (preferably email). and, oh, i'm using turbo pascal v5.0. THANX -- one two! one two! & through & through /=============================/ hear your the vorpal blade went snicker-snack! / tpehrson@javelin.sim.es.com / death boon he left it dead, and with his head /=====aka: tim clinkenpeel====/ the wail of he went galumphing back [DISCLAIMER: send SASE to: disclaimer, 84151-0521] DOOM