Newsgroups: comp.lang.pascal
Path: utzoo!utgpu!watserv1!watmath!nmouawad
From: nmouawad@watmath.waterloo.edu (Naji Mouawad)
Subject: Re: Help me (problems with strings)
Message-ID: <1991Apr18.221625.13529@watmath.waterloo.edu>
Organization: University of Waterloo
References: <1991Apr18.020517.7767@javelin.sim.es.com> <6792@awdprime.UUCP>
Date: Thu, 18 Apr 1991 22:16:25 GMT
Lines: 31


In article <1991Apr18.020517.7767@javelin.sim.es.com tpehrson@javelin.sim.es.com writes:
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;

You should typecast string into char by issing the command
  huh := char(copy(txt,x,1));

But you don't need to do so, for you could replace

   case huh of

by case txt[i] of 

--Naji.
-- 
     -------------------------------------------------------------------
    | Naji Mouawad  |          nmouawad@watmath.waterloo.edu            |
    |  University   |---------------------------------------------------|
    | Of Waterloo   |   "The Stranger in us is our most familiar Self"  |
