On Friday, 23 September 2022 at 22:17:51 UTC, Paul Backus wrote:
Apologies for the confusion. You can use
[stripRight](https://phobos.dpldocs.info/std.string.stripRight.2.html)
We have a saying: Estaghfirullah!
Thank you all so much because it has been very useful for me.
I learned two things:
* First, we can use strip() functions with parameters:
https://dlang.org/phobos/std_algorithm_mutation.html#.strip
(examples are very nice)
* Second, we could walk through the string in reverse and with
indexOf():
https://github.com/dlang/phobos/blob/master/std/string.d#L3418
**Source Code:**
```d
//import std.string : stripRight;/*
string stripRight(string str, const(char)[] chars)
{
import std.string : indexOf;
for (; !str.empty; str.popBack())
{
if (chars.indexOf(str.back) == -1)
break;
}
return str;
}//*/
```
Delicious...
SDB@79