Topic: TRIM and UNION string problem

Hello,
i have a problem to work with string:
1) The Trim function don't work (my error??);
2) The union string don't work

I send a sample project for this error

It's possible to have also TrimLeft and TrimRight function?

thank's

Post's attachments

Attachment icon esempio_TRIM.7z 272.63 kb, 489 downloads since 2014-09-20 

Re: TRIM and UNION string problem

Hello,


1) Trim works in your project.
Trim: Remove spaces from the beginning and end.


2)
Fixed code:

procedure Form1_btn_trim_OnClick (Sender: string; var Cancel: boolean);
var
   invert, s : string;
   i : Integer;
begin
    invert := '';
    i := Length(Form1.txb_orig.text);
    Form1.txb_trim.text := Trim(Form1.txb_orig.text);   //Works            

    s := Form1.txb_orig.text;
    while(i > 0 ) do
    begin
      ShowMessage(ord(s[i]));
      if ( ((ord(s[i]) >= 65) AND (ord(s[i]) <= 90)) ) or // for CAPITAL chars
         ( ((ord(s[i]) >= 97) AND (ord(s[i]) <= 122)) )  then // for small chars
      begin
        invert := invert + s[i]; // Works        
      end;
      i := i - 1;
    end;

    Form1.txb_union.text :=  invert;
end;


In current version there is no TrimLeft and TrimRight functions.

Dmitry.

Re: TRIM and UNION string problem

thank's ...I thought TRIM function removes space also intra word.

Very thank's