In Hour 3, I use this code to demonstrate how to replace my last name (Ray) with “is awesome!”:
var myFullName: String = "John Ray"
var myDescription: String = myFullName.stringByReplacingOccurrencesOfString(myFullName,
withString: "is awesome!")
This is incorrect. As written, this would replace “John Ray” (myFullName) with “is awesome!” – not just “Ray”. The proper code should read:
var myFullName: String = "John Ray"
var myDescription: String = myFullName.stringByReplacingOccurrencesOfString("Ray",
withString: "is awesome!")