Article View: borland.public.delphi.language.objectpascal
Article #202Re: Remove Spaces Function
From: Mike Williams (TeamB)
Date: Mon, 26 Jan 2004 15:38
Date: Mon, 26 Jan 2004 15:38
25 lines
1489 bytes
1489 bytes
On 26 Jan 2004, "Yehia Ahmed" <yehiaeg@hotmail.com> wrote:
> I wrote this procedure which remove the spaces after and before the
> "equal"
I would suggest writing a function that takes a string and returns a
string that is in the desired format. Perhaps something like this:
function RemoveSpaces (St : string) : string;
var l, r, p : integer;
begin
Result := st;
p := pos('=', Result);
l := p-1;
r := p+1;
while (l > 0) and (Result[l] = ' ') do dec(l);
while (r < Length(Result)) and (Result[r] = ' ') do inc(r);
Delete(Result, l+1, r-l-1);
insert(' = ', Result, l+1);
end;
You can then call this function once for each line.
--
-Mike (TeamB)
Technical Details
Message-ID:
<Xns947C7676C3E92mikewteamb@207.105.83.66>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40153f7d@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109d30,8b4ceee2931b0643,start X-Google-Attributes: gid109d30,public X-Google-ArrivalTime: 2004-01-26 08:43:20 PST Newsgroups: borland.public.delphi.language.objectpascal Subject: Re: Remove Spaces Function From: "Mike Williams (TeamB)" <mikew@remove.aps-soft.com> References: <40153f7d@newsgroups.borland.com> Organization: APS, Inc Message-ID: <Xns947C7676C3E92mikewteamb@207.105.83.66> User-Agent: Xnews/5.04.25 NNTP-Posting-Host: 66.107.65.98 Date: 26 Jan 2004 08:38:42 -0700 X-Trace: newsgroups.borland.com 1075135122 66.107.65.98 (26 Jan 2004 08:38:42 -0700) Lines: 25 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail