2017-04-14 4 views
-4

私はstring.splitを実行してから配列の最初の位置を呼び出しましたが、なんらかの理由ですべての配列結果が表示されます。これはJavaで分割するには?

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

+0

あなたは 'Strings'の間に'、 'を追加していません –

+0

あなたは私を助けることができますか? – jose

+0

'z.getContents()'が返す文字列の形式は何ですか? 'String'の例を挙げてください。 –

答えて

0

\\\\に分割してください。 Like

String exampleString = "A\\B\\C\\D"; //escaping the "\" character 
String array[] = exampleString.split("\\\\");