?
Solved

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

Posted on 2003-02-25
3
Medium Priority
?
268 Views
Last Modified: 2010-04-04
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.
0
Comment
Question by:Mark Brady
3 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 200 total points
ID: 8018809
what about the trim function

you can use it by adding like

combobox1.items.add(trim('SomeValue         '));

or when you retrieve
like

somevar := trim(combobox1.items[combobox1.itemindex]);
or
somevar := trim(combobox1.text);

see also trimleft or trimright

meikl ;-)
0
 
LVL 4

Expert Comment

by:cjm30305
ID: 8019651
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
0
 
LVL 20

Author Comment

by:Mark Brady
ID: 8023004
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
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
Suggested Courses
Course of the Month9 days, 4 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question