Thread overview
French and Greek strings
Nov 17, 2021
pascal111
Nov 17, 2021
H. S. Teoh
Nov 17, 2021
Kagamin
November 17, 2021

How can I use types to make string and char variables that hold French and Greek characters?

November 16, 2021
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
November 17, 2021

You can use the string type to hold non-ascii characters. Just a substring of another string.