简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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