PHP使用explode分割JAVA使用split分割
D语言使用的是split分割使用split是需要引用std.array库
string str = "Learning,D,is,fun"; writeln(str.split(",")); writeln(split(str, ",")); //输出结果:["Learning", "D", "is", "fun"]
更详细的内容请参考https://dlang.org/library/std/array/split.html
数组转字符串代码:
string[] strArr = ["Learning", "D", "is", "fun"]; string str = strArr.join(","); writeln(str); // 输出结果:"Learning,D,is,fun"