www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - French and Greek strings

reply pascal111 <judas.the.messiah.111 gmail.com> writes:
How can I use types to make string and char variables that hold 
French and Greek characters?
Nov 16 2021
next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
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
Nov 16 2021
prev sibling parent Kagamin <spam here.lot> writes:
You can use the string type to hold non-ascii characters. Just a 
substring of another string.
Nov 17 2021