2017-07-18 40 views

回答

0

你應該解釋更詳細的您的問題。

我想你想要的是這樣的:

s = '(818001,818002)(151515,151515)' //the string you have. 
s = s.replace(')(',',').replace('(','').replace(')','');// output "818001,818002,151515,151515" 
final_string = s.split(','); //output (4) ["818001", "818002", "151515", "151515"] 
0

如果您需要在您的字符串數組中刪除逗號(或其他任何字符爲此事)指數最簡單的是通過數組和使用迭代String.replace()

String[] s = {"818001,818002","121212","151515,151515"}; 
for(int i=0; i<s.length; i++) { 
    s[i] = s[i].replace(",", ""); 
} 
System.out.print(Arrays.toString(s)); // [818001818002, 121212, 151515151515]