Decoding of Strings as Ranges of dchar
Understand how automatic decoding of strings as ranges of dchar happens.
We'll cover the following
Automatic decoding of strings
Being character arrays by definition, strings can also be used as ranges just by importing std.array
. However, char
and wchar
strings cannot be used as RandomAccessRange.
std.array
provides a special functionality with all types of strings. Iterating over strings becomes iterating over Unicode code points, not over UTF code units. As a result, strings appear as ranges of Unicode characters.
The following strings contain ç
and é
, which cannot be represented by a single char
, and 𝔸
(mathematical double-struck capital A), which cannot be represented by a single wchar
:
Get hands-on with 1400+ tech skills courses.