Fast removal of character

Johan Engelen j at j.nl
Wed Oct 11 22:22:43 UTC 2017


std.string.removechars is now deprecated.
https://dlang.org/changelog/2.075.0.html#pattern-deprecate

What is now the most efficient way to remove characters from a 
string, if only one type of character needs to be removed?

```
// old
auto old(string s) {
     return s.removechars(",").to!int;
}

// new?
auto newnew(string s) {
     return s.filter!(a => a != ',').to!int;
}
```

cheers,
    Johan


More information about the Digitalmars-d-learn mailing list