• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 408
  • Last Modified:

how to cut down a tedit ?

when i paste the following into a tedit..

Item/Product Number:  11068319597887

how would i cut out the word and space: Item/Product Number:  

Just to leave in the editbox the actual number ?

----------

also, the same for this one, to cut out "Buyer's User ID:  "
Buyer's User ID:  ptom1747


I have a few more to do, but if someone can help with these i can do the rest, please please keep it as simple as possible so i can learn from it then i can advance to make it more complex and better.
0
boycoder
Asked:
boycoder
  • 3
  • 2
1 Solution
 
jimyXCommented:
If the format will always be "xxxxx: ######" then use this code:
procedure TForm1.Button1Click(Sender: TObject);
var
  Str:String;
begin
  Str:=Eit1.Text;
  Str:=Trim(copy(Str,pos(':',Str)+1,length(Str)-pos(':',Str)+1));
  Showmessage(Str);
end;

Open in new window

0
 
boycoderAuthor Commented:
hah! clever jim that, nice idea of cutting it all before the :

it works, but how would i work it into a better output. Instead of showing messages.
i want to do the following:

DBitem.Text := Memo1.Lines.Strings[3];

The actual item/number: is online 3. I want to put it into DBitem.text
0
 
jimyXCommented:
Here you are:
procedure TForm1.Button1Click(Sender: TObject);
var
  Str:String;
begin
  Str:=Memo1.Lines.Strings[3];
  DBitem.Text:=Trim(copy(Str,pos(':',Str)+1,length(Str)-pos(':',Str)+1));
end;

Open in new window

0
 
boycoderAuthor Commented:
cheers Jim, first class as always!
0
 
boycoderAuthor Commented:
A+
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now