On Saturday, 11 December 2021 at 00:39:15 UTC, forkit wrote:
On Friday, 10 December 2021 at 22:35:58 UTC, Arjan wrote:

"abc;def;ghi".tr(";", "", "d" );


I don't think we have enough ways of doing the same thing yet...

so here's one more..

"abc;def;ghi".substitute(";", "");

Using libraries can trigger hidden allocations.

```
import std.stdio;

string garbagefountain(string s){
    if (s.length == 1) return s == ";" ? "" : s;
return garbagefountain(s[0..$/2]) ~ garbagefountain(s[$/2..$]);
}

int main() {
    writeln(garbagefountain("abc;def;ab"));
    return 0;
}

```

Reply via email to