On Thursday, 22 September 2022 at 21:49:36 UTC, Ali Çehreli wrote:
On 9/22/22 14:31, Salih Dincer wrote:

If you have multiple '\0' chars that you will continue looking for, how about the following?

It can be preferred in terms of working at ranges. But it isn't useful in terms of having more than one character and moving away from strings. For example:

```d
    auto data = [ "hello", "and", "goodbye", "world" ];
auto hasZeros = data.joiner("\0\0").text; // ("hello\0\0", "and\0\0", "goodbye\0\0", "world\0\0")

    assert(hasZeros.count('\0') == 7);
    assert(hasZeros.splitz.walkLength == data.length * 2 - 1);

auto range = hasZeros.splitz; // ("hello", "", "and", "", "goodbye", "", "world")
```
SDB@79

Reply via email to