Re: How to mixin repeated text?

2018-08-27 Thread Andrey via Digitalmars-d-learn
On Monday, 27 August 2018 at 11:56:08 UTC, Kamil Koczurek wrote: Mixins seem to be an overkill here. Maybe something like this would suffice: data[index + 1 .. index + 5].map!(k => k[0]).array == "" Here there is dynamic code, with memory allocs. I found solution: ---

Re: How to mixin repeated text?

2018-08-27 Thread Kamil Koczurek via Digitalmars-d-learn
On Monday, 27 August 2018 at 11:52:02 UTC, Andrey wrote: Hello again, I have this part of code: ... if(index + 3 >= data.length || data[index + 1][0] == '&' || data[index + 2][0] == '&' || data[index + 3][0] == '&' || data[index + 4][0] == '&') { writeln("Some text..."); } I don't want t

How to mixin repeated text?

2018-08-27 Thread Andrey via Digitalmars-d-learn
Hello again, I have this part of code: ... if(index + 3 >= data.length || data[index + 1][0] == '&' || data[index + 2][0] == '&' || data[index + 3][0] == '&' || data[index + 4][0] == '&') { writeln("Some text..."); } I don't want to write manually these four "or" conditions because in ea