"strstr" D equivalent

rassoc rassoc at posteo.de
Fri Jul 29 11:41:38 UTC 2022


On 7/29/22 13:23, pascal111 via Digitalmars-d-learn wrote:
> Is there an equivalent in D for C function "strstr" that return the first occurrence of a given 
> string within another string?
> 
> https://en.cppreference.com/w/c/string/byte/strstr

You can use `find` from https://dlang.org/library/std/algorithm/searching/find.html for that.

And since you asked about std lib functions in another thread, the algorithm docs page has lots of 
useful functions and examples for searching, comparing, iterating, etc: 
https://dlang.org/library/std/algorithm.html


More information about the Digitalmars-d-learn mailing list