[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2004-03-22
4
Medium Priority
?
401 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

656 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