digitalmars.D.learn - strip and dmd 2.056
- bioinfornatics (6/6) Dec 10 2011 dear,
- bearophile (12/20) Dec 10 2011 'blah'
- Jonathan M Davis (8/32) Dec 10 2011 None of the strip or split functions in Phobos deal with anything other ...
dear, 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 ?
Dec 10 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' 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";;;;;;blah".lstrip(";")
Dec 10 2011
On Saturday, December 10, 2011 16:18:22 bearophile wrote:bioinfornatics:None of the strip or split functions in Phobos deal with anything other than whitespace. splitter is more general, but there is no stripper (which would arguably be a horrible name for a function anyway). However, that's essentially what find does, albeit with the predicate effectively being reversed. e.g. find!"a != ';'"(";;;;;blah"); - Jonathan M Davisit 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' 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); }";;;;;;blah".lstrip(";")
Dec 10 2011