Character codes: Difference between revisions

Content deleted Content added
Updated D entry
Line 164: Line 164:


void main() {
void main() {
string test = "a";
string test = "a";
size_t index = 0;
size_t index = 0;

// get four-byte utf32 value for index 0
// Get four-byte utf32 value for index 0
// this returns dchar, so cast it to numeric
// this returns dchar, so cast it to numeric.
writefln(cast(uint) test.decode(index));
writeln(cast(uint)test.decode(index));
// index has moved to next character position in input

assert(index == 1);
// 'index' has moved to next character position in input.
assert(index == 1);
}</lang>
}</lang>
{{out}}
<pre>97</pre>


=={{header|Delphi}}==
=={{header|Delphi}}==