I know that there will be lots of pointers to duplicates but this worked before I updated to xcode 6.3 and now it has a problem with it.
The script:
exte
var str = "Hello, playground" extension String { func removeCharsFromEnd(n:Int) -> String { return substringWithRange(Range(start: startIndex, end: advance(startIndex, count(self) < n ? 0 : count(self)-n ))) } } "Hello, playground".removeCharsFromEnd(3) // "Hello, playgro" "