str3 = "welcome to play swift!Step-by-Step learn from now" str3.componentsSeparatedByCharactersInSet(NSCharacterSet(charactersInString: " !-")) //join var str5 = "-" str5.join(["1","2","3"]) //range str3.rangeOfString("Step")//(22,4) str3.rangeOfString("Step",options:NSStringCompareOptions.BackwardsSearch)//(30,4) str3.rangeOfString("welcome",options:NSStringCompareOptions.CaseInsensitiveSearch)//(0,7)
还是objective-C的风格