About string and int spliced together.
zoujiaqing
zoujiaqing at gmail.com
Thu Jun 18 09:00:42 UTC 2020
Now dlang string processing is complex, like this:
```D
import std.stdio;
import std.conv;
void main()
{
string name = "Brian";
uint age = 18;
string text = "My name is " ~ name ~ " and my age is " ~
age.to!string ~ ".";
writeln(text);
}
```
Type should be automatically converted to string!
It should be:
```D
import std.stdio;
void main()
{
string name = "Brian";
uint age = 18;
string text = "My name is " ~ name ~ " and my age is " ~ age
~ ".";
writeln(text);
}
```
Like java:
```D
String name = "Brian";
int age = 18;
System.out.println("My name is " + name + " and my age is " + age
+ ".");
```
More information about the Digitalmars-d
mailing list