Replace string in string


I have a string and want to replace all occurrences of a substring with another string.


// String literal
let s = "Hello World"

// Replace "World" with "Guys"

let b = s.stringByReplacingOccurrencesOfString("World", withString:"Guys")

Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)