www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How make wsatring or dstring default for string and literals?

reply Marcone <marcone email.com> writes:
I live in Brazil and speak português brasileiro and need make 
programs that is good with words like ã, á, ç, ê, etc. How can I 
make wstring or dstring default for string and literals? I don't 
want to explicit this every time.
Feb 24 2020
parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Monday, 24 February 2020 at 19:27:04 UTC, Marcone wrote:
 I live in Brazil and speak português brasileiro and need make 
 programs that is good with words like ã, á, ç, ê, etc.
Regular string works with those just fine too.
Feb 24 2020
parent reply Marcone <marcone email.com> writes:
On Monday, 24 February 2020 at 19:28:43 UTC, Adam D. Ruppe wrote:
 On Monday, 24 February 2020 at 19:27:04 UTC, Marcone wrote:
 I live in Brazil and speak português brasileiro and need make 
 programs that is good with words like ã, á, ç, ê, etc.
Regular string works with those just fine too.
foreach(i; "Canção") { writeln(i); } Prints: C a n � � � � o
Feb 24 2020
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Monday, 24 February 2020 at 21:25:50 UTC, Marcone wrote:
 	foreach(i; "Canção")
 Prints:
Try foreach(dchar i; "Canção") // note the added dchar to see a different presentation of the very same data. If you take the strings apart byte by byte that will look different, but they all represent the same characters, and foreach can help decode that if you ask it to.
Feb 24 2020