如何存储包含的字符串;到java中的String []

时间:2017-04-27 07:13:16

标签: java

我在

中输入了字符串
String x = "સ્થિતિ";  
// WHich is Hex NCR cooded string contains & # x 0 and ; for e.g. &#x0AB ;

String sFinalData = 87508~~~~20~false@87512~x~~~22~true

我正在使用以下代码。

String[] sPropertyString = sFinalData.split("@");
for(int iter=0;iter<sPropertyString.length;iter++){
   String[] sProperty = sPropertyString[iter].split("~");
   sPropertyName = sProperty[1];
   System.out.println("O/P..."+sPropertyName );
}

但对于上面的代码,它显示数组索引超出范围。

我需要将此Hex NCR字符串存储到数据库中。

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

sPropertyName = sProperty[1];数组索引是否超出绑定异常来自这一行?为什么你使用索引1,也许sProperty.length是1.然后最大索引是0。