Check if string contains string

 Problem

I want to check if a string contains another string



 Recipe


// String literal
let s = "Hello World"

// Check if it contains 'Hello'

if s.rangeOfString("Hello") != nil {
    print("Yes it contains 'Hello'")
}

				


 Playground