简体   繁体   English

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

[英]How to store string which contains ; to String[] in java

I have input string in 我在输入字符串

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

I am using following code. 我正在使用以下代码。

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 );
}

But for above code it is showing array index out of bound. 但是对于上面的代码,它显示数组索引超出范围。

I need to store this Hex NCR string to database. 我需要将此十六进制NCR字符串存储到数据库。

Any suggestion? 有什么建议吗?

sPropertyName = sProperty[1]; is array index out of bound Exception come from this line? 是数组索引超出范围的异常来自此行? why you use index 1 , maybe sProperty.length is 1.then the max index is 0. 为什么使用索引1,也许sProperty.length为1,那么最大索引为0。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM