View previous topic :: View next topic |
Author |
Message |
cicak Expert Cheater
Reputation: 0
Joined: 02 Apr 2007 Posts: 159 Location: Cheat Engine
|
Posted: Fri May 30, 2008 1:38 pm Post subject: [Delphi] Need Help With TMemo1 |
|
|
How do I do this
Let say text in my memo1 is
Code: | Hi
lol
Myname = *random text* //*random text* can be asd,qwer,az,phrzacefq,mftb blabla... |
I want to get the text next to the Myname = '' or *random text*
then show it on showmessage _________________
|
|
Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Fri May 30, 2008 2:17 pm Post subject: |
|
|
Try this: Code: | var
I,SlashPos:Integer;
MyText:String;
begin
for I:=0 to memo1.Lines.Count-1 do
begin
SlashPos:=Pos('//',memo1.Lines[I]);//get the pos of '//' in the line
if SlashPos > 0 then //check if '//' found
begin //if true get the wanted text and break
MyText:=copy(memo1.Lines[I],SlashPos,length(memo1.Lines[I])-SlashPos);
break;
end;
end;
end; |
|
|
Back to top |
|
 |
cicak Expert Cheater
Reputation: 0
Joined: 02 Apr 2007 Posts: 159 Location: Cheat Engine
|
Posted: Fri May 30, 2008 2:38 pm Post subject: |
|
|
Thanks HolyBlah. +rep
But I want to get the text after Myname =
not after //
I edited the code to
Code: | var
I,SlashPos:Integer;
MyText:String;
begin
for I:=0 to memo1.Lines.Count-1 do
begin
SlashPos:=Pos('Myname =',memo1.Lines[I]);//get the pos of '//' in the line
if SlashPos > 0 then //check if '//' found
begin //if true get the wanted text and break
MyText:=copy(memo1.Lines[I],SlashPos,length(memo1.Lines[I])-SlashPos);
//break;
showmessage (mytext)
end;
end;
end; |
it works. btw is it possible not to show 'Myname =' on showmessage? Only show the text after 'Myname =' _________________
|
|
Back to top |
|
 |
Snootae Grandmaster Cheater
Reputation: 0
Joined: 16 Dec 2006 Posts: 969 Location: --->
|
Posted: Sat May 31, 2008 12:26 am Post subject: |
|
|
just find out which line it's in and then use string - 'Myname =' _________________
|
|
Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Sat May 31, 2008 1:38 am Post subject: |
|
|
You can use the Value property for this: Code: | showmessage(memo1.Lines.Values['Myname ']); |
|
|
Back to top |
|
 |
cicak Expert Cheater
Reputation: 0
Joined: 02 Apr 2007 Posts: 159 Location: Cheat Engine
|
Posted: Sat May 31, 2008 6:19 am Post subject: |
|
|
Thanks again HolyBlah. That one more simple  _________________
|
|
Back to top |
|
 |
|