Skip to main content
2 of 5
added 11 characters in body
Eric
  • 54.4k
  • 11
  • 104
  • 196

This will split it and remove whitespace:

String initialString = 'Malcolm Bell Landgraab | EMP-00012 | Consultant';
String[] results = initialString.trim().split('\\s*\\|\\s*');
system.debug(results);

Of course you will want to add in all the usual checks for null, errors, etc.

Eric
  • 54.4k
  • 11
  • 104
  • 196