ardakaraca ardakaraca - 11 months ago 44
Swift Question

How to delete part of string indicated after a character?

This is what I need.

var str = "This is an |#|example text!"

After deleting:

str = "This is an "


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]


str = subdividedStringArray.first