startsWith

Joel joelcnz at gmail.com
Sun Oct 1 05:33:36 UTC 2023


```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.



More information about the Digitalmars-d-learn mailing list