On Thursday, 30 December 2021 at 09:34:27 UTC, eugene wrote:
```d
char[] s = cast(char[])ioCtx.buf[0 .. strlen(cast(char*)ioCtx.buf.ptr) - 1];
// -1 is to eliminate terminating '\n'
writefln("got '%s' from '%s:%d'", s, client.addr, client.port);
```
Is there some more concise/elegant way to do that?

```d
char[] s = fromStringz(cast(char*)ioCtx.buf.ptr).strip;
writefln("got '%s' from '%s:%d'", s, client.addr, client.port);
```

Well, this will do:)

Reply via email to