I need no space at end of my string

I Need to read from a file and
I don’t now the length of  "Ch6"
It can be 18 character long
I put it in a form.edit.text
and I need not the space from right.

I try the TrimRight but it take the space to

ex1…
Edit3.Text:=TrimRight(copy(Ch6,20,18));

ex2..        
Edit3.Text:=copy(Ch6,20,18);
Edit3.Text:=TrimRight(Edit3.Text)

……………………………..

I test the length on Edit3 and it still is 18

    Edit7.Text:=IntToStr(Length(Edit3.Text));

Are I stupid or is it wrong to do like this..

Help/janne  
LVL 6
Dark_KingAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PeterLarsenCommented:
I you sure that the last character is a chr(32) and not a different one ?? And have you tried to use TRIM ??
0
Dark_KingAuthor Commented:
I read from a text file and it is space after a word
Ex
002af608a7e8      RUM322             Rum322-01

Example if I need the RUM322 I copy start to length (Fixed length) 18 characters ..
In this case copy(Ch6,19,18);

then I reg. it to windows register
It while be wrong if I not can use TRIM
0
Dark_KingAuthor Commented:
I read file like this

if  FileExists(mac1) Then
    begin
    AssignFile(F1,  mac1) ;

    Reset(F1);
     while not Eof(F1) do
      begin
        Readln(F1, Ch6);
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

PeterLarsenCommented:
I tried this and found no problems !!??!!

procedure TForm1.Button14Click(Sender: TObject);
var
d : string;
begin
d:='002af608a7e8      RUM322             Rum322-01';
edit1.text:=trim(copy(d,19,18));
edit2.text:=inttostr(length(edit1.text));
end;

Regards
Peter
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dark_KingAuthor Commented:
Is edit2.text = 6 or 18
I wont it to be 6
0
PeterLarsenCommented:
In my sample it have a length of 6.
0
Dark_KingAuthor Commented:
I stupide I look at frong text
Sorry
you still Earn the 10 points

Thanks
0
PeterLarsenCommented:
:-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.