From: "Philippe Ranger" <.> Subject: Re: Remove comma(s) from String Date: 21 Apr 1999 00:00:00 GMT Message-ID: <7fkn21$4dt15@forums.borland.com> References: <7fkdd2$4dm3@forums.borland.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: PhilippeRanger@RemoveThis.compuserve.com Reply-To: "Philippe Ranger" Newsgroups: borland.public.delphi.objectpascal < 0 do Delete(aStr, Pos(',', AStr), 1); Result := aStr; end; >> You're right about the inefficiency. The true answer is to go get the free HyperString from http://efd.home.mindspring.com/tools.htm (source is $39). Otherwise, I'd like to correct Roman's blind infatuation with pointers, and so slow too -- Function stripChar (s: string; c: char): string; (*Returns s minus all occurrences of c*) Var js: integer; //current index into s js0: integer; //index of first uncopied char in s jr: integer; //first unused position in result Begin setLength(result, length(s)); js0 := 1; jr := 1; for js := 1 to length(s) do if (s[js] = c) then begin move(s[js0], result[jr], js-js0); inc(jr, js-js0); js0 := js + 1; end; move(s[js0], result[jr], length(s) + 1 - js0); setLength(result, jr + length(s) - js0); End; PhR