Skip to main content
1 of 2
Vamsi Krishna Gosu
  • 10.5k
  • 5
  • 33
  • 50

Split in Apex is very similar to Java string split.

the pattern you pass to the split method is not a direct match, its a REGEX pattern. so the pipe symbol | is considered as a Regex input and it splits the string into individual characters.

You can use the below code to get thru this

newString.split('\\|')

here's some other discussions around the same topic

http://stackoverflow.com/questions/6978901/splitting-a-string-using

and a blog post from Lacey on the same topic

Vamsi Krishna Gosu
  • 10.5k
  • 5
  • 33
  • 50