Idea: Introduce zero-terminated string specifier
David Nadlinger
see at klickverbot.at
Tue Oct 2 12:17:42 PDT 2012
On Tuesday, 2 October 2012 at 02:22:33 UTC, Steven Schveighoffer
wrote:
> @system char[] zstr(char *s) { return s[0..strlen(s)]; }
>
> […]
>
> Does it make sense for Phobos to provide such a shortcut in an
> obscure header somewhere? Like std.cstring? Or should we just
> say "roll your own if you need it"?
I didn't look it up, so I could be making quite a fool of myself
right now, but doesn't to!string(char*) provide exactly that?
David
More information about the Digitalmars-d
mailing list