Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!munnari.oz.au!uniwa!cc.curtin.edu.au!sdalelt From: sdalelt@cc.curtin.edu.au Newsgroups: comp.lang.pascal Subject: Re: Dose anybody have space det. code!!!!!!!!! Message-ID: <1991Apr28.131624.7940@cc.curtin.edu.au> Date: 28 Apr 91 05:16:24 GMT References: <1991Apr22.060051.2238@nuchat.sccsi.com> Organization: Curtin University of Technology Lines: 30 In a msg dated [Mon Apr 22 1991], Robert Oliver Jr. wrote (to All): > ROJ: dose any body have some code that can detect a space in a > ROJ: string[40] and replace it with a -, but if there is not a > ROJ: space then dont do anything ? You talk about string[40], so I presume you're using a version of pascal which isn't ISO. (ie. turbo). If you are using Turbo Pascal, here is an elegant solution. Although I see others have responded to you query, this is probably a better way to get the end result: function change_spaces(s : string) : string; begin while pos(' ', s) > 0 do s[pos(' ', s)] := '-'; change_spaces := s; end; Cheers, Lincoln. _____________________________________________________________________________ Internet: sdalelt@cc.curtin.edu.au Voice: +61-9-459-4701 lincoln_dale@f627.n690.z3.fidonet.org FidoNet: Lincoln Dale @ 3:690/627.0 Data: +61-9-493-1534 PSImail: psi%050529452300070::sdalelt +61-9-493-2625 UUCP: uunet!munnari.oz!cc.curtin.edu.au!sdalelt Bitnet: sdalelt%cc.curtin.edu.au@cunyvm.bitnet