Advent of Code 2019
Steven Schveighoffer
schveiguy at gmail.com
Tue Nov 26 15:17:18 UTC 2019
On 11/26/19 7:00 AM, Sergei Nosov wrote:
> On Monday, 25 November 2019 at 15:30:47 UTC, Steven Schveighoffer wrote:
>>
>> https://dlang.org/phobos/std_ascii.html#toLower
>> https://dlang.org/phobos/std_ascii.html#toUpper
>> https://dlang.org/phobos/std_utf.html#byCodeUnit
>>
>
> Thanks!
>
> byCodeUnit seems to be the working out alright.
>
> I believe, I've tried `byChar` previously and couldn't make it work
> (because I was under misconception that it has the semantics of
> `byCodeUnit`).
Yeah, byCodeUnit basically tells Phobos to ignore autodecoding, and
treats it like the array that it is for the purposes of algorithms and
ranges. It should provide all the same underlying mechanisms that the
array provides, including random access, at least that's the purpose.
byChar I think is a conversion routine, meant to be used to shoehorn
e.g. a wchar[] or dchar[] into a utf8 range. In fact, byChar returns
byCodeUnit if the types are equal (or at least it should). If it wasn't
working but byCodeUnit is, please file an issue.
-Steve
More information about the Digitalmars-d
mailing list