Solved

Simple question: find variable in edit1.text = ?????/

Posted on 2004-03-22
4
390 Views
Last Modified: 2012-05-04
Hi,

I've got a quick question:

I have on a form:

Edit1
Edit2
Button1
label1

The text in Edit1 is: User Field 1://Variable/...

User Field 1://

and

/...

remain constant throughout

However "Variable" always equals Edit2.text

So for example you could have:

Edit2.text := Andy

Edit1.text: User Field 1://Andy/...

I need to simply parse the variable in Edit1

So on button1.click --> label1.caption := the variable from edit1.text ie, Andy.


Obviously you cant just have label1.caption := Edit2.text it has to parse Edit1

If you can help please provide a full souce code snippet - it helps us all!

Many thanks

Andy.
0
Comment
Question by:AndrewShanklin
  • 2
4 Comments
 
LVL 4

Expert Comment

by:tobjectpascal
ID: 10653801
procedure TForm1.Button1Click(Sender: TObject);
Var
 Tmp: String;
begin
 Tmp:=Edit1.Text;
 Delete(Tmp,1,Pos('//',Edit1.Text)+1);
 Tmp:=Copy(Tmp,1,Pos('/',Tmp)-1);
 Label1.Caption:=Tmp;
end;


I think you mean that, i am half asleep right now.
0
 
LVL 4

Accepted Solution

by:
tobjectpascal earned 50 total points
ID: 10653807
oops replace

Delete(Tmp,1,Pos('//',Edit1.Text)+1);
for
Delete(Tmp,1,Pos('//',Tmp)+1);
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 10655668
As you know the length of the Prefix part (User Field 1://) that is 15 you could simply do:

Label1.Capiton := Copy(Edit1.Text,16,pos('/...',Edit1.Text)-16);
0
 

Author Comment

by:AndrewShanklin
ID: 10667529
Many thanks

A.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now