"Awesome".contains("me") == true "Awesome".contains("Aw") == true "Awesome".contains("so") == true "Awesome".contains("Dude") == false "ReplaceMe".replace("Me", withString: "You") == "ReplaceYou" "MeReplace".replace("Me", withString: "You") == "YouReplace" "ReplaceMeNow".replace("Me", withString: "You") == "ReplaceYouNow" "0123456789"[0] == "0" "0123456789"[5] == "5" "0123456789"[9] == "9" "0123456789"[5...6] == "5" "0123456789"[0...1] == "0" "0123456789"[8...9] == "8" "0123456789"[1...5] == "1234" "Reply"[0...4] == "Repl" "Hello, playground"[0...5] == "Hello" "Coolness"[4...7] == "nes" "Awesome".indexOf("nothin") == -1 "Awesome".indexOf("Awe") == 0 "Awesome".indexOf("some") == 3 "Awesome".indexOf("e", startIndex: 3) == 6 "Awesome".lastIndexOf("e") == 6 "Cool".lastIndexOf("o") == 2 var emailRegex = "[a-z_\\-\\.]+@[a-z_\\-\\.]{3,}" "email@test.com".isMatch(emailRegex, options: NSRegularExpressionOptions.CaseInsensitive) == true "email-test.com".isMatch(emailRegex, options: NSRegularExpressionOptions.CaseInsensitive) == false var testText = "email@test.com, other@test.com, yet-another@test.com" var matches = testText.getMatches(emailRegex, options: NSRegularExpressionOptions.CaseInsensitive) matches.count == 3 testText.subString(matches[0].range.location, length: matches[0].range.length) == "email@test.com" testText.subString(matches[1].range.location, length: matches[1].range.length) == "other@test.com" testText.subString(matches[2].range.location, length: matches[2].range.length) == "yet-another@test.com" "Reply".pluralize(0) == "Replies" "Reply".pluralize(1) == "Reply" "Reply".pluralize(2) == "Replies" "REPLY".pluralize(3) == "REPLIES" "Horse".pluralize(2) == "Horses" "Boy".pluralize(2) == "Boys" "Cut".pluralize(2) == "Cuts" "Boss".pluralize(2) == "Bosses" "Domino".pluralize(2) == "Dominoes"