wstring format
Jonathan M Davis
jmdavisProg at gmx.com
Sun Feb 20 22:49:23 PST 2011
On Sunday 20 February 2011 21:26:05 Bekenn wrote:
> Is there a wstring version of string.format? I can't seem to find it
> anywhere...
There probably isn't one. A lot of functions are string-only and do not work
with char[], wchar[], dchar[], wstring, or dstring. That may or may not change
in the future, but the result is that often the best way to do things is to just
use string everywhere and then convert to one of the others when you need to.
A lot of the problem is that to implement string functions for each string type
tends to up forcing you to actually have at least 3 different implementations for
the same function. Range-based functions treat all strings as ranges of dchar,
so _they_ tend to work with any string type, there are downsides to some
functions treating a string as a range of dchar, so the functions in std.string
don't do that, and most functions that specifically want some type of string
don't do that. It's generally just the functions which deal with generic ranges
which treat strings as ranges.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list