www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How use lineSplitter with KeepTerminator flag?

reply Marcone <marcone email.com> writes:
I want add Yes.keepTerminator flag on lineSplitter.
Jun 09
parent =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 6/9/21 2:48 PM, Marcone wrote:
 I want add Yes.keepTerminator flag on lineSplitter.
It's a template parameter, which is specified after an exclamation mark. The trouble is, Flag is defined in std.typecons. I would expect std.typecons (or at least Flag from it) to be publicly imported but it is not. I think that is an interface bug: If it appears in the interface (of lineSplitter), it should be available without needing to import additional modules. import std.string; import std.stdio; import std.typecons; void main() { auto input = "line1\nline2\nline3"; auto range = input.lineSplitter!(Yes.keepTerminator); writeln(range); } Ali
Jun 09