Solved

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

Posted on 2004-03-22
4
394 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 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