On Tuesday, 16 November 2021 at 19:18:50 UTC, pascal111 wrote:
I used "to" keyword which "std.conv" includes for data
conversions, but I think that there are some other ways for
data conversions, or maybe there are common ways like casting,
I hope to know about. For example, next program are using "to":
Strictly speaking it's not a keyword, just a template name.
std.conv is pretty good for conversions like this. You can read
about casting at
https://dlang.org/spec/expression.html#CastExpression , and I
have a quickref for string conversions at
https://d.minimaltype.com/index.cgi/wiki?name=string+type+conversions
There's a lot to say about string conversions. Phobos date&time
conversions deserve a quickref like that, too. On numerical
conversions, D is very similar to other languages. OOP casting is
noteworthy in that it can fail with `null`.