0

I have a string in the form Final Test|0.

I wanted the string to be split into 2

[0] = Final Test
[1] = 0

Below is the code i was working on:

String value = "Final Test|0";
String[] mainValues = value .split(" | "); 

Using the above code i got

[Final, Test|0]

Even tried doing this

  String value = "Final Test|0";
  String[] mainValues = value .split("|"); 

Also when i tried escaping the white space using regex i got

F,i,n,a,l,,T,e,s,t,|,0

Please guide.

sTg
  • 4,313
  • 16
  • 68
  • 115

0 Answers0