Swift String

String

String class is String handle class in swift.

Compare

We use isEqualToString, compare methods to compare text in NSString.
In String, you can use == method

let str = "bbb"
if (str == "aaa") {
   // Same
}

Convert NSString

Use as it is

let str : String = "Test"
let strns = str as NSString

You can strns as NSString

contains

Use rangeOfString

if (str.rangeOfString("") != nil) {
}