在c#中的字符串数组输出中生成换行符

时间:2017-05-22 04:19:36

标签: c# asp.net arrays gridview

如何在以下代码中的单词之间进行换行?我想显示每个输出都有这样的换行符,以便它可以正常看到。这是我想要的代码和输出:

for (int i = 0; i < tabLayout.getTabCount(); i++) {
        tabLayout.getTabAt(i).setIcon(imageResId[i]);
        tabLayout.getTabAt(i).setText(textResId[i]);
    }

link output that i want

2 个答案:

答案 0 :(得分:1)

以下是谷歌为您提供的第一个结果,adding line break, 或简称\r\n

答案 1 :(得分:0)

我在for循环中做了一些更改,以制作示例代码段:

   string colValue = "job order: 124"+System.Environment.NewLine+System.Environment.NewLine;
            string colValue2 = "Quantity: 100" + System.Environment.NewLine + System.Environment.NewLine;
            string colValue3 = "Need by Date:2/5/2017" + System.Environment.NewLine + System.Environment.NewLine;
            string colValue4 = "Status: Pending"+System.Environment.NewLine;
            string finalString = colValue + colValue2 + colValue3 + colValue4;

在前端我得到以下输出:

enter image description here

希望它对你有用。