Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!xanth!cs.odu.edu!popkin From: popkin@cs.odu.edu (Brian N. Popkin) Newsgroups: comp.lang.pascal Subject: Re: Dose anybody have space det. code!!!!!!!!! Message-ID: <1991Apr28.150459.631@cs.odu.edu> Date: 28 Apr 91 15:04:59 GMT References: <1991Apr22.060051.2238@nuchat.sccsi.com> <1991Apr28.131624.7940@cc.curtin.edu.au> Sender: usenet@cs.odu.edu (Usenet News Poster) Reply-To: popkin@cs.odu.edu (Brian N. Popkin) Organization: Old Dominion University, Norfolk, VA Lines: 42 Nntp-Posting-Host: osric.cs.odu.edu In article <1991Apr28.131624.7940@cc.curtin.edu.au> sdalelt@cc.curtin.edu.au writes: >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; > Theres so many ways to handle this simple problem... Brian *-----------------------------------------------------------------------------* * * * Brian Popkin * * Computer Science Major - Systems Programing * * Old Dominion University * * Norfolk, Virginia USA * * * * Others Areas Of Interest: Artificial Intelligence, Expert Systems, * * Networks, And Telecommunications * * * * Email Address: popkin@cs.odu.edu * * popkin@xanth.cs.odu.edu * * popkin@gnu.ai.mit.edu * * * *-----------------------------------------------------------------------------*