dlang 字符串char[] 和string

各个情况下数据类型异同

 1 import std.stdio;
 2 import std.string;
 3 
 4 void main(){
 5     
 6     auto a="auto_a";       //immutable(char)[]
 7     auto b="auto_b.dup".dup;   // char[]
 8     string c="string_c";   //immutable(char)[]
 9     string d="string_d.dup".dup;  //immutable(char)[]
10     char[] e="char_e.dup".dup;  //char[]
11     char[] f="char_f.dup".dup;  //char[]
12     char[6] g="char_g";  //char[6]
13 
14     writeln(typeid(a));
15     writeln(typeid(b));
16     writeln(typeid(c));
17     writeln(typeid(d));
18     writeln(typeid(e));
19     writeln(typeid(f));
20     writeln(typeid(g));
21 }

posted @ 2020-12-14 22:04  天使不设防  阅读(154)  评论(0编辑  收藏  举报