[Lazarus] [resulved] How to use TRegExpr class (in synregexpr.pas)

Frederic Da Vitoria davitofrg at gmail.com
Fri Oct 25 10:17:22 CEST 2013


2013/10/24 Mark Morgan Lloyd <markMLl.lazarus at telemetry.co.uk>

> FreeMan wrote:
>
>> Yes Mark, you rigth.
>> This code is working now, Problem was space char in EDT_IP.Text, it comes
>> from format. This is normal, but at this time, why "Trim" function NOT
>> DELETE space char ????? is this bug ?
>>
>> var Q : String;Const WhiteSpace = [#0..' '];
>>     function My_Trim(S : string): String;     var I: Integer;     begin
>>     Result := S;       Try        I := 1;        while I<Length(S)do Begin
>>         if S[I]in WhiteSpace then Delete(S,I,1)         else Inc(I,1);
>>    end;    // while        Result := S;       Except       end;     end;
>> //copied from /fpc271/rtl/objpas/sysutils/**sysstr.inc  line 524
>> function Trim_(const S: string): string;     var Ofs, Len: integer;
>> begin       len := Length(S);       while (Len>0) and (S[Len] in
>> WhiteSpace) do        dec(Len);       Ofs := 1;       while (Ofs<=Len) and
>> (S[Ofs] in WhiteSpace) do        Inc(Ofs);       result := Copy(S, Ofs, 1 +
>> Len - Ofs);     end ;begin   Q := Trim(EDT_IP.Text);// space not deleted
>> Q := Trim_(EDT_IP.Text);// space not deleted   Q := My_Trim(EDT_IP.Text);
>> // space DELETED   if IP4OK(Q)then begin..............
>>
>
> By the time that arrived here its formatting had been completely lost (as
> you can see above), but it doesn't look to bad in the archive
> http://lists.lazarus.freepascal.org/pipermail/lazarus/2013-October/084020.htmlso I'm not entirely sure what's going on


The formatting seemed correct in GMail.

-- 
Frederic Da Vitoria
(davitof)

Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131025/f9bbfebf/attachment-0003.html>


More information about the Lazarus mailing list