document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. String string = "P001412-COMPLETED"; //Input string
  2.  
  3. if (string.contains("-")) {
  4.     String[] result= string.split("-");
  5.     String result1 = result[0]; // P001412
  6.     String result2 = result[1]; // COMPLETED
  7. } else {
  8.     throw new IllegalArgumentException("String " + string + " does not contain -");
  9. }
');