How can I use types to make string and char variables that hold French and Greek characters?
Thread overview | |||||
---|---|---|---|---|---|
|
November 17, 2021 French and Greek strings | ||||
---|---|---|---|---|
| ||||
November 16, 2021 Re: French and Greek strings | ||||
---|---|---|---|---|
| ||||
Posted in reply to pascal111 | On Wed, Nov 17, 2021 at 12:58:43AM +0000, pascal111 via Digitalmars-d-learn wrote: > How can I use types to make string and char variables that hold French and Greek characters? For strings, just use `string`. :-) D strings are Unicode by default, no further effort is needed to use it. Individual characters are a bit more tricky. Usually you can just use dchar, but keep in mind that a dchar is not always the same thing as an on-screen character. The latter can sometimes be composed of multiple dchars; if for whatever reason you need to handle this distinction, you need to use std.uni.Grapheme. (It's a bad idea to use Grapheme by default, because grapheme segmentation is very expensive and will slow down your program if overused. Don't use it unless you actually need to.) T -- If the comments and the code disagree, it's likely that *both* are wrong. -- Christopher |
Copyright © 1999-2021 by the D Language Foundation