Article View: borland.public.delphi.language.objectpascal
Article #205Re: Remove Spaces Function
From: valentin tihomirov
Date: Mon, 26 Jan 2004 16:43
Date: Mon, 26 Jan 2004 16:43
16 lines
1606 bytes
1606 bytes
Because the only possible cause of exception is GetMemory, therefore, no
need to use try/except inside the loop (user is not interested in line
number of mem_not_avail_exception).
function RemoveSpaces(var s: string): string;
Result := '';
for i = 1 to length(s) do begin
c := s[i];
if c <> #32 then
Result := Result + c;
end if;
end if;
end;
There is a more effective way. Just use instructions to find out next
location of space and move memory block up to this mark.
Technical Details
Message-ID:
<401543a6$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-09!supernews.com!216.170.153.135.MISMATCH!tdsnet-transit!newspeer.tds.net!diablo.voicenet.com!yellow.newsread.com!netaxs.com!newsread.com!newsfeed00.sul.t-online.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 X-Google-Attributes: gid109d30,public X-Google-ArrivalTime: 2004-01-26 09:11:53 PST From: "valentin tihomirov" <valentin_NOSPAM_NOWORMS@abelectron.com> Newsgroups: borland.public.delphi.language.objectpascal References: <40153f7d@newsgroups.borland.com> Subject: Re: Remove Spaces Function Date: Mon, 26 Jan 2004 18:43:07 +0200 Lines: 18 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 80.235.104.171 Message-ID: <401543a6$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1075135398 80.235.104.171 (26 Jan 2004 08:43:18 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-09!supernews.com!216.170.153.135.MISMATCH!tdsnet-transit!newspeer.tds.net!diablo.voicenet.com!yellow.newsread.com!netaxs.com!newsread.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail