?
Solved

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

Posted on 2004-03-22
4
Medium Priority
?
398 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 200 total points
ID: 10653807
oops replace

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

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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month11 days, 21 hours left to enroll

752 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