字符串格式化

以前常用的是:string.format("{0}{1}, a, b)这样格式。

实际上还有一种格式更好一点:

string id = "10";

int m = 20
string str = $"linezero-{id}, {m}";

字符串需要前导字符$

posted @ 2018-03-06 12:50  81  阅读(143)  评论(0)    收藏  举报