RosettaCodeData/Task/Character-codes/D/character-codes.d

13 lines
264 B
D
Raw Permalink Normal View History

2013-04-10 16:57:12 -07:00
void main() {
2015-02-20 00:35:01 -05:00
import std.stdio, std.utf;
2013-04-10 16:57:12 -07:00
string test = "a";
size_t index = 0;
2015-02-20 00:35:01 -05:00
// Get four-byte utf32 value for index 0.
writefln("%d", test.decode(index));
2013-04-10 16:57:12 -07:00
2015-02-20 00:35:01 -05:00
// 'index' has moved to next character input position.
2013-04-10 16:57:12 -07:00
assert(index == 1);
}