format string 能否自定义格式
假如:
string text="abcdefgh";
能否通过 “Format” 把它变为:
text="ab-cd-ef-gh";
如果可以的话,应该怎么写格式串呢? 谢谢
[解决办法]
string input = "1234";
string output = Regex.Replace(input, @"(.{2})", "$1-").TrimEnd('-');
Console.WriteLine(output);