Link to home
Start Free TrialLog in
Avatar of Mark Brady
Mark BradyFlag for United States of America

asked on

Remove the ' ' (blanks spaces) from combobox1 item ?

Hi team
This is a simple one but I can't get it right Grrrr.  
I need to copy only the bytes or text with values from combobox1.itemindex.

The item has 20 bytes in it.  The first so many contain a name and the rest is blank up to 20.  If I use the whole line for a label name, and set autosize to true, the label width obviously sizes itself to fit 20 characters.

What is the code to only copy until that line shows a blank ' '  ????

Thanks in advance

Mark

p.s.  The blank spaces need to be in the combobox for a reason.
ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

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

function GetOnlyTextWithoutBlanks(Str: String): String;
begin
  Str := StringReplace(Str, ' ', EmptyStr, [rfReplaceAll]);
  Result := Str;
end;

That will get any spaces before or after the text, and return only the text.

Jake
Avatar of Mark Brady

ASKER

Excellent !!!  So simple and yet so far from my reach lol.  That is a great little function that I have never heard of.  Thank you so much.

Mark