string comparison in swift code example
Example 1: swift compare strings
print("foo".elementsEqual("bar")) //false
Example 2: how to compare two strings in swift
let str1 = "Hello, world!"
let str2 = "I love Swift."
let str3 = "Hello, world!"
// compare str1 and str2
print(str1 == str2)
// compare str1 and str3
print(str1 == str3)