[fpc-pascal] Re: Trim(): incompatibility with Delphi

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Tue Mar 6 09:14:44 CET 2012


Flávio Etrusco wrote:
> On Mon, Mar 5, 2012 at 11:36 PM, leledumbo <leledumbo_cool at yahoo.co.id> wrote:
>>> Fpc Trim(): Trim whitespace from the ends of a string.
>> Where did you get that? The documentation
>> (http://www.freepascal.org/docs-html/rtl/sysutils/trim.html) doesn't say
>> so...
>>
> 
> And a simple test confirms the docs (FPC 2.6):
> 
>   ShowMessage(Trim('test             ') + Trim ('       !'));

More to the point, putting in control characters instead of spaces:

program trimtest;

uses SysUtils;

begin
   WriteLn(Trim('test' + #$0d + #$0a) + Trim (#$0d + #$0a + '!'))
end.

test!

Unless there's some weird locale-specific problem.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list