On Saturday, 17 August 2024 at 05:28:37 UTC, Bruce wrote:
Example.
I want to find the index of an item in an array.
```
import std.stdio;
import std.string;

void main()
{
   string text = "Hello, World!";
   string searchSubstring = "World";

   ptrdiff_t index = text.indexOf(searchSubstring);

   if (index != -1)
   {
writeln("The substring '", searchSubstring, "' found at index ", index);
   }
   else
   {
writeln("The substring '", searchSubstring, "' not found in the string.");
   }
}
```
  • Re: How to find ... monkyyy via Digitalmars-d-learn
    • Re: How to ... Bruce via Digitalmars-d-learn
    • Re: How to ... Ron Tarrant via Digitalmars-d-learn
    • Re: How to ... Renato Athaydes via Digitalmars-d-learn
    • Re: How to ... Lance Bachmeier via Digitalmars-d-learn
    • Re: How to ... Steven Schveighoffer via Digitalmars-d-learn
      • Re: How... Vinod K Chandran via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
          • ... Vinod K Chandran via Digitalmars-d-learn
        • Re:... IchorDev via Digitalmars-d-learn
          • ... Vinod K Chandran via Digitalmars-d-learn
      • Re: How... Ron Tarrant via Digitalmars-d-learn
        • Re:... Renato Athaydes via Digitalmars-d-learn

Reply via email to