strip and dmd 2.056

bearophile bearophileHUGS at lycos.com
Sat Dec 10 13:18:22 PST 2011


bioinfornatics:

> it seem now we can not use this:
>  ";;;;;;blah".stripLeft(";");
>  Error: template std.string.stripl(String) cannot deduce template
> function from argument types !()(string,string)
> 
> 
> they are another way ?

In Python str.lstrip accepts an optional argument:

>>> ";;;;;;blah".lstrip(";")
'blah'


But I think with the current Phobos you need to use something like this:

import std.stdio, std.string;
void main() {
    string s = ";;;;;;blah";
    munch(s, ";");
    writeln(s);
}

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list