spacer graphic
spacer graphic
Montage of games AGS Logo
spacer graphic

 

spacer graphic
Menu
spacer graphic Home
About
News
Features
Download AGS
spacer graphic Games 
Games main page
Award Winners
Picks of the month
Short games
Medium length games
Full length games
In Production
Hints & Tips
Community
Forums
AGSers World Map
Member websites
Chat
Resources
Tutorials
FAQ
Knowledge Base
Downloads
Links
AGS-related links
* AGS Manual
  * Scripting
    * String functions

IndexOf

(Formerly known as global function StrContains, which is now obsolete)
(Formerly known as String.Contains, which is now obsolete)

String.IndexOf(string needle)
Checks to see if NEEDLE is contained within the specified string. Returns the character position of the match if it is, or -1 if it is not.

This function is not case sensitive; ie. testing "test string" for "sTRiN" would match.

Example:

String haystack = "The haystack had a needle in it somewhere.";
int result = haystack.IndexOf("a needle");

if (result == -1) { Display("The string didn't contain the needle."); } else { Display("a needle was found starting at character %d in the string.", result); }

See Also: String.EndsWith, String.StartsWith


User comments and notes
There are currently no user comments on this page.
The user comment facility is currently disabled.