Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!decwrl!pa.dec.com!hollie.rdg.dec.com!decuk.uvo.dec.com!e2big.mko.dec.com!guest From: granoff@vaxwrk.enet.dec.com (Mark H. Granoff) Newsgroups: comp.lang.pascal Subject: Re: Dose anybody have space det. code!!!!!!!!! Message-ID: <1991Apr23.155720.1561@e2big.mko.dec.com> Date: 23 Apr 91 15:57:20 GMT References: <1991Apr23.133227.10746@macc.wisc.edu> Sender: guest@e2big.mko.dec.com (Guest (DECnet)) Reply-To: granoff@vaxwrk.enet.dec.com (Mark H. Granoff) Organization: Digital Equipment Corporation, Maynard MA Lines: 22 In article <1991Apr23.133227.10746@macc.wisc.edu>, pschwart@vms.macc.wisc.edu (Paul Schwartz) writes: > In Turbo Pascal you can treat a string like an array, therefore > > for i := 1 to length(my_string) do { for each char in the string } > if my_string[i] = chr(20) then { if the char is a space } > my_string[i] = chr(45) { replace it with a - } Your example is fine, but your numeric base is wrong, once. :-) Replace chr(20) with either chr(32) or #32. ASCII 32 is a space, not 20. However, 20 hex is 32 decimal, so I guess you are forgiven. :-) --------------------------------------------------------------------------- Mark H. Granoff | Enterprise Integration Services/Engineering VAXworks --------------------------------------------------------------------------- Digital Equipment Corporation | Internet: granoff@vaxwrk.enet.dec.com 129 Parker Street | Usenet : ...!decwrl!vaxwrk.enet!granoff PKO2-1/M21 | AT&T : +1 508 493 4512 Maynard, MA 01754 | FAX : +1 508 493 2240 --------------------------------------------------------------------------- Opinions herein are my own and do not necessarily reflect those of Digital. ---------------------------------------------------------------------------