-1

伙计们,我需要您对以下查询的帮助----我的字符串如下:

"Symbol Exchange    Security Type   Mid Extraction time Net Change  Last price  Bid price   Ask price"

我想将其拆分如下

"Symbol,Exchange,Security Type,Mid,Extraction time,Net Change,Last price,Bid price,Ask price"

请帮助解决以下查询,因为split(\\s+)没有提供所需的解决方案!

4

2 回答 2

2

假设间隙是制表符:

String sentence = "Symbol Exchange    Security Type   Mid Extraction time Net Change  Last price  Bid price   Ask price";

String newSentence = sentence.replace('\t', ',');

参考: String.replace()

于 2013-02-08T05:46:30.077 回答
0

你试过这个:

String s = "Your source string";
String m = s.replace(" ", ",");

试试看。

于 2013-02-08T05:46:58.873 回答