Skip to main content
added 276 characters in body
Source Link
Umer Farooq
  • 7.5k
  • 7
  • 45
  • 69

You have @ in your string I don't see [@] any where, so why are you splitting the string with this token.

Change

String[] str1 = str.split("[@]") 

to

String[] str1 = str.split("@") 

For solving indexOutOfBounds:

for (int x = 1; x < str1.length; x++) { String[] st1 = str1 [x].trim().split("\\|"); for (int j = 0; j < st1.length; j++) { System.out.println( j "= " + st1[j].trim()); } } 

You have @ in your string I don't see [@] any where, so why are you splitting the string with this token.

Change

String[] str1 = str.split("[@]") 

to

String[] str1 = str.split("@") 

You have @ in your string I don't see [@] any where, so why are you splitting the string with this token.

Change

String[] str1 = str.split("[@]") 

to

String[] str1 = str.split("@") 

For solving indexOutOfBounds:

for (int x = 1; x < str1.length; x++) { String[] st1 = str1 [x].trim().split("\\|"); for (int j = 0; j < st1.length; j++) { System.out.println( j "= " + st1[j].trim()); } } 
Source Link
Umer Farooq
  • 7.5k
  • 7
  • 45
  • 69

You have @ in your string I don't see [@] any where, so why are you splitting the string with this token.

Change

String[] str1 = str.split("[@]") 

to

String[] str1 = str.split("@")