This is what you want:
var subdividedStringArray = str.componentsSeparatedByString("|#|")
now you have an array with 2 strings, you can access the first one with:
str = subdividedStringArray[0]
or:
str = subdividedStringArray.first
0
solved How to delete part of string indicated after a character? [duplicate]