Hey
I'm trying to split a string down the middle. I thought the
function std.range.evenChunks would be perfect for this:
```
#!/usr/bin/env -S rdmd -I..
import std.range;
void main() {
string line = "abcdef";
auto parts = evenChunks(line, 2);
assert(parts == ["abc", "
On Monday, 13 March 2023 at 00:32:07 UTC, zjh wrote:
Thank you for your reply, but is there any way to output `gbk`
code to the console?
I guess if your console is in gbk encoding, you can just write
bytes with stdout.write.
```D
struct Matrix(S, size_t M, size_t N)
{
}
alias Vector(S, size_t N) = Matrix!(S, N, 1);
enum isVector(V) = is(V == Vector!(S, N), S, size_t N); // it
doesn't work
enum isVectorCorrect(V) = is(V == Matrix!(U, N, 1), U, size_t N);
// the "correct" way and how much I like to REPEAT myself!
On Tuesday, 14 March 2023 at 09:20:54 UTC, Kagamin wrote:
I guess if your console is in gbk encoding, you can just write
bytes with stdout.write.
Thank you for your reply, but only display bytes, not gbk text.
On Tuesday, 14 March 2023 at 10:19:24 UTC, Elfstone wrote:
```D
struct Matrix(S, size_t M, size_t N)
{
}
alias Vector(S, size_t N) = Matrix!(S, N, 1);
enum isVector(V) = is(V == Vector!(S, N), S, size_t N); // it
doesn't work
enum isVectorCorrect(V) = is(V == Matrix!(U, N, 1), U, size_t
N);
On Tuesday, 14 March 2023 at 06:20:29 UTC, Mike Parker wrote:
On Tuesday, 14 March 2023 at 05:47:35 UTC, Jeremy wrote:
[...]
Manifest constants in D have a similar effect as #defined
values, e.g.:
[...]
Thanks a lot!
On Tuesday, 14 March 2023 at 08:21:00 UTC, amarillion wrote:
I'm trying to understand why this doesn't work. I don't really
understand the error. If I interpret this correctly, it's
missing a length attribute on a string, but shouldn't length be
there?
By default, D's standard library treats
Thanks a lot for taking the time and replying in that much detail!
On Saturday, 11 March 2023 at 21:07:18 UTC, H. S. Teoh wrote:
I also came from a C/C++ background. The GC turned me off D
for a long time, until one day I decided to just give it a try
to see if it was all as bad as people made
On Saturday, 11 March 2023 at 22:14:36 UTC, rempas wrote:
The `foreach` will cover your needs like you said but
ironically enough, I like and use the original `for` loop.
Thanks for your reply as well, rempas... I guess I covered most
things in my earlier reply, but on the `for` loop:
Coming f
On Tuesday, 14 March 2023 at 17:57:38 UTC, ionkare wrote:
On Tuesday, 14 March 2023 at 10:19:24 UTC, Elfstone wrote:
```D
struct Matrix(S, size_t M, size_t N)
{
}
alias Vector(S, size_t N) = Matrix!(S, N, 1);
enum isVector(V) = is(V == Vector!(S, N), S, size_t N); // it
doesn't work
enum is
10 matches
Mail list logo