On Friday, November 9, 2018 5:22:27 AM MST Vinay Sajip via Digitalmars-d-
learn wrote:
> On Friday, 9 November 2018 at 11:24:42 UTC, Jonathan M Davis
>
> wrote:
> > decode and decodeFront are for converting a UTF code unit to a
> > Unicode code point. So, you're taking UTF-8 code unit (char),
> >
On Friday, 9 November 2018 at 11:24:42 UTC, Jonathan M Davis
wrote:
decode and decodeFront are for converting a UTF code unit to a
Unicode code point. So, you're taking UTF-8 code unit (char),
UTF-16 code unit (wchar), or a UTF-32 code unit (dchar) and
decoding it. In the case of UTF-32,
On Friday, November 9, 2018 3:45:49 AM MST Vinay Sajip via Digitalmars-d-
learn wrote:
> On Friday, 9 November 2018 at 10:26:46 UTC, Dennis wrote:
> > On Friday, 9 November 2018 at 09:47:32 UTC, Vinay Sajip wrote:
> >> std.utf.decodeFront(Flag useReplacementDchar =
> >> No.useReplacementDchar,
On Friday, 9 November 2018 at 10:45:49 UTC, Vinay Sajip wrote:
As I see it, a ubyte 0x20 could be decoded to an ASCII char '
', and likewise to wchar or dchar. It doesn't (to me) make
sense to decode a char to a wchar or dchar. Anyway, you've
shown me how decodeFront can be used, so great!
On Friday, 9 November 2018 at 10:26:46 UTC, Dennis wrote:
On Friday, 9 November 2018 at 09:47:32 UTC, Vinay Sajip wrote:
std.utf.decodeFront(Flag useReplacementDchar =
No.useReplacementDchar, S)(ref S str) if (isInputRange!S &&
isSomeChar!(ElementType!S))
This is the overload you want, let's
On Friday, 9 November 2018 at 09:47:32 UTC, Vinay Sajip wrote:
std.utf.decodeFront(Flag useReplacementDchar =
No.useReplacementDchar, S)(ref S str) if (isInputRange!S &&
isSomeChar!(ElementType!S))
This is the overload you want, let's check if it matches:
ref S str - your InputRange can be
According to the std.utf documentation,
decode will only work with strings and random access ranges of
code units with length and slicing, whereas decodeFront will
work with any input range of code units.
However, I can't seem to get such a usage to compile: the
following code
import