Re: Is there a standard function that combines take() and popFrontExactly()

2020-12-14 Thread realhet via Digitalmars-d-learn
On Monday, 14 December 2020 at 14:16:41 UTC, Dukc wrote: On Friday, 11 December 2020 at 19:07:23 UTC, realhet wrote: I've just made this unicode wordreplacer function working, but It seems not too nice and functional-ish. Are there ways to make it more simple? To answer the title, yes there

Re: Is there a standard function that combines take() and popFrontExactly()

2020-12-14 Thread Dukc via Digitalmars-d-learn
On Friday, 11 December 2020 at 19:07:23 UTC, realhet wrote: I've just made this unicode wordreplacer function working, but It seems not too nice and functional-ish. Are there ways to make it more simple? To answer the title, yes there is: ``` foreach(isWord, len; str.map!fun.group){ auto

Is there a standard function that combines take() and popFrontExactly()

2020-12-11 Thread realhet via Digitalmars-d-learn
Hi, I've just made this unicode wordreplacer function working, but It seems not too nice and functional-ish. Are there ways to make it more simple? import std.stdio, std.range, std.algorithm, std.uni, std.utf, std.conv; bool isWordChar(dchar ch){ return isAlphaNum(ch) || ch=='_'; }