Link to home
Start Free TrialLog in
Avatar of Dark_King
Dark_King

asked on

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  
Avatar of PeterLarsen
PeterLarsen

I you sure that the last character is a chr(32) and not a different one ?? And have you tried to use TRIM ??
Avatar of Dark_King

ASKER

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
I read file like this

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

    Reset(F1);
     while not Eof(F1) do
      begin
        Readln(F1, Ch6);
ASKER CERTIFIED SOLUTION
Avatar of PeterLarsen
PeterLarsen

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Is edit2.text = 6 or 18
I wont it to be 6
In my sample it have a length of 6.
I stupide I look at frong text
Sorry
you still Earn the 10 points

Thanks