Hello.
How do I search for a keyword in a string?
Like...
variable1 := 'How do I check to see if Voltrox is contained in this string?';
Then search variable1 to determine if it contains Voltrox.
Hello.
How do I search for a keyword in a string?
Like...
variable1 := 'How do I check to see if Voltrox is contained in this string?';
Then search variable1 to determine if it contains Voltrox.
Nicholas.
<br />
<br />Please join: http://holzstukka.proboards81.com
use function "pos"
This is my game project - Top Down City:
http://www.pascalgamedevelopment.com...y-Topic-Reboot
My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
http://www.pascalgamedevelopment.com...source+manager
How do I use pos?
I see substring and wide string when i type it.
But I don't know how to use it.
Nicholas.
<br />
<br />Please join: http://holzstukka.proboards81.com
use delphi help perhaps?!?Originally Posted by Voltrox
Pos returns the index value of the first character in a specified substring that occurs in a given string.
Unit
System
Category
string handling routines
function Pos(Substr: string; S: string): Integer;
Description
Pos searches for a substring, Substr, in a string, S. Substr and S are string-type expressions.
Pos searches for Substr within S and returns an integer value that is the index of the first character of Substr within S. Pos ignores case-insensitive matches. If Substr is not found, Pos returns zero.
This is my game project - Top Down City:
http://www.pascalgamedevelopment.com...y-Topic-Reboot
My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
http://www.pascalgamedevelopment.com...source+manager
type Pos and pres F1:
Returns the index value of the first character in a specified substring that occurs in a given string.
Unit
System
Syntax
[Delphi] function Pos(const substr: string; const str: string): Integer; overload;
[Delphi] function Pos(const substr: WideString; const str: WideString): Integer; overload;
Description
In Delphi, Pos searches for a substring, Substr, in a string, S. Substr and S are string-type expressions.
Pos searches for Substr within S and returns an integer value that is the index of the first character of Substr within S. Pos is case-sensitive. If Substr is not found, Pos returns zero.
EDIT: @Delfi, LOL
NecroSOFT - End of line -
Oh. So how do I get the index that's the end of the string?
Is there a way to do a thing called IF the string is found in the variable then execute my code?
Nicholas.
<br />
<br />Please join: http://holzstukka.proboards81.com
well maybe by using simple math?
increment that returned index from Pos by the length of the string searched....and yes, you can branch your code depending on that...if you're just interested if the string is present, use Pos and check the result <> 0...if it is non-zero, the substring has been found....
Ok. Thank you.
I'll do that.
Nicholas.
<br />
<br />Please join: http://holzstukka.proboards81.com
Bookmarks