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.");
} } ```
