Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,16 @@
void main() {
import std.stdio;
import std.algorithm: startsWith, endsWith, find, countUntil;
"abcd".startsWith("ab").writeln; // true
"abcd".endsWith("zn").writeln; // false
"abab".find("bb").writeln; // empty array (no match)
"abcd".find("bc").writeln; // "bcd" (substring start
// at match)
"abab".countUntil("bb").writeln; // -1 (no match)
"abab".countUntil("ba").writeln; // 1 (index of 1st match)
// std.algorithm.startsWith also works on arrays and ranges:
[1, 2, 3].countUntil(3).writeln; // 2
[1, 2, 3].countUntil([2, 3]).writeln; // 1
}