string or ForwardRange of characters to search in correct UTF format
substring to search for
Yes.caseSensitive (default) or No.caseSensitive
the index of the first occurrence of sub in s with respect to the start index startIdx. If sub is not found, then -1 is returned. If the arguments are not valid UTF, the result will still be in the range [-1 .. s.length], but will not be reliable otherwise. If sub is found the value of the returned index is at least startIdx.
If the sequence starting at startIdx does not represent a well formed codepoint, then a std.utf.UTFException may be thrown.
Does not work with case insensitive strings where the mapping of tolower and toupper is not 1:1.
import std.typecons : No; string s = "Hello World"; assert(indexOf(s, "Wo", 4) == 6); assert(indexOf(s, "Zo", 100) == -1); assert(indexOf(s, "wo", 3, No.caseSensitive) == 6);
import std.typecons : No; string s = "Hello World"; assert(indexOf(s, "Wo") == 6); assert(indexOf(s, "Zo") == -1); assert(indexOf(s, "wO", No.caseSensitive) == 6);
Searches for substring in s.