The err variable contains a message. The format will be the same but the value -1 will change accordingly.

String err = "Result:-1|Error|sSide: Value Must Be Either b|s."

Therefore I attempted to retrieve -1 value from err variable using the code below:

String[] temp2 = err.trim().split(":");
StringTokenizer st = new StringTokenizer(temp2[1],"|");
while(st.hasMoreTokens()){
try{        		
  int x = Integer.parseInt(st.nextToken());
}
catch(NumberFormatException nFE){
}

However I am getting wrong results.

Your help is kindly appreciated.

Regards,

Eugene

"wrong results" doesn't help identify anything.
But, it's probably easier & quicker to use indexOf to get the indices of the first ':' and '|' and substring the part between those two indexes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.