Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

C Sharp string.IndexOf

From Coderwiki
Revision as of 13:05, 15 August 2025 by Dylan (talk | contribs) (new: info, example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

C Sharp implements the IndexOf method on the string type.

See String position for general information on the usage of this method.

string haystack = "Hello world, C# is a programming language";
string needle = "C#";
int position = haystack.IndexOf(needle);
Console.WriteLine(position);

Output:

13
Contents