【发布时间】:2017-04-14 13:29:59
【问题描述】:
我做了一个 string.split,然后调用了数组的第一个位置,但由于某种原因,所有的数组结果都出现了。这是我的代码
try {
String xx = "";
for (int i = 0; i < row; i++) {
for (int c = 0; c < col; c++) {
Cell z = s.getCell(c, i);
xx = xx + z.getContents() + "\n";
}
xx = xx + "\n";
}
//I do the split here but the result[0] = all the information
String result[] = xx.split(",");
textView.setText(result[0]);
} catch (Exception e) {
}
这是输出的图像: Description of the output
【问题讨论】:
-
你没有在
Strings之间添加, -
那么你能帮帮我吗?
-
z.getContents()返回的字符串格式是什么?举个例子String。 -
text\text2....我放了输出的图片
-
如果字符串没有逗号,你为什么指望
.split(",")做任何事情?