Peter Gerwinski wrote:
Hello, Thomas; hello, GPC-list!
According to Thomas Dunbar:
can one convert a string of length one into a char?
ie the below wont work:
program t(input,output); var ch:char; s:string(10); begin s:='teststring'; writeln(substr(s,2,1)); ch:=substr(s,2,1); writeln(ord(ch)); end.
Yes, one can. The correct assignment reads
ch:= s [ 2 ];
thanks, Peter.
i also find that readstr(substr(s,2,1),ch); works but the packed array way is simpler.
thomas
I think, this is Standard Pascal, nothing special. At least, it is common between UCSD, Borland and GNU Pascal.
In the above sense, a string actually *is* a packed array of char.
Yours,
Peter
Dipl. Phys. Peter Gerwinski Fachbereich Physik Universitaet-GH Essen Phone: +49-201-183-2763 D-45117 Essen Fax: +49-201-183-2120 Germany e-mail: pege@mail.theo-phys.uni-essen.de