我遵循了这个 WordPress 教程,效果很好。我使用了列表视图,当我尝试格式化字符串时,它无法识别\t
(但可以识别\n
)。它也不会识别String.Format
等。
无论如何,我可以使用制表符或类似的东西来格式化字符串吗?
干杯
编辑
for( i = 0; i < lstView.Items.Count;i++)
{
name = lstView.Items[i].Text;
state = lstView.Items[i].SubItems[1].Text;
country = lstView.Items[i].SubItems[2].Text;
line += name + "\t" + state + "\t" + country + "\n";
}
StringReader reader = new StringReader(line);
当 line 用于打印时,字符串被连接在一起,所以 \t 不起作用。新行的 \n 确实有效。有谁知道我可以在不使用空格的情况下格式化字符串的任何方式。
结果是这样的
名称StateCountry
加长名称StateCountry
anotherNameAnotherStateAnotherCountry
我希望他们在哪里排列(比如在表格中),名称为一列,说明另一列和国家,然后是第三个
任何建议都非常感谢