字符串:Hello there my\r\nName is\r\nJohn Smith\r\nand\r\nstuff现在每行放一个新列表项需要的结果(带有单独列表项的列表视图):Hello there my
--------------
Name is
--------------
John Smith
--------------
and
--------------
stuff我用了\r\n解析字符串,然后用数组调试器将每行插入一个数组设置列表视图。但是只是出现换行效果,我得到了一个textView,如下(这是一个textView)。Hello there my
Name is
John Smith
and
stuff有方法能不让它创建新行,这样我可以解析到数组吗?String[] myText = {"Helo there my", "Name is", "John Smith", "and", "stuff"};
1 回答

慕盖茨4494581
TA贡献1850条经验 获得超11个赞
你完全可以用spilt:
String[] myText="Hello there my\\r\\nName is\\r\\nJohn Smith\\r\\nand\\r\\nstuff".split("\r\n");
添加回答
举报
0/150
提交
取消