Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!ox.com!math.fu-berlin.de!unidui!unido!rwthinf!rwthi3!ricki From: ricki@martha.informatik.rwth-aachen.de (Richard Breuer) Newsgroups: comp.lang.pascal Subject: Re: Dose anybody have space det. code!!!!!!!!! Message-ID: Date: 25 Apr 91 12:20:14 GMT References: <1991Apr22.060051.2238@nuchat.sccsi.com> Sender: news@rwthinf.UUCP Lines: 24 robby@nuchat.sccsi.com (Robert Oliver Jr.) writes: >dose any body have some code that can detect a space in a string[40] and replace it with a -, but if there is not a space then dont do anything ? >any help would be greatlee appreated. Try this (Turbo Pascal): --- schanipp schanapp -------------------------------------------------------- procedure cb(var s: string40); var p: integer; begin { Calculate the position of the first space. 0, when there is none } p:=pos(' ',s); { Substitute it } if (p>0) then s[p] := '-' end; --- schanipp schanapp -------------------------------------------------------- I did not test it, but it should run. Bye, Ricki.