startsWith
Imperatorn
johan_forsberg_86 at hotmail.com
Sun Oct 1 05:42:45 UTC 2023
On Sunday, 1 October 2023 at 05:33:36 UTC, Joel wrote:
> ```d
> void main() {
> import std.string : split;
> import std.algorithm.searching : startsWith;
>
> string bk="Exo";
>
> assert(("Gen Exo Lev Num Deu Jos Judg Rut 1Sam 2Sam".split~
> "1Kin 2Kin 1Chr 2Chr Ezra Neh Est Job Psa Pro Ecc
> Son Isa Jer".split~
> "Lam Eze Dan Hos Joel Amos Oba Jon Mic Nah Hab Zep
> Hag Zec".split~
> "Mal Mat Mar Luk Joh Act Rom 1Cor 2Cor Gal Eph Phili
> Col".split~
> "1The 2The Titu Phile Heb Jam 1Pet 2Pet 1Joh 2Joh 3Joh
> Jude Rev".split)
> .startsWith(bk));
> }
> ```
>
> Why doesn't this work? canFind works though.
Because it starts with Gen, not Exo.
More information about the Digitalmars-d-learn
mailing list