How to compare two strings in Swift
Swift has a double equals == comparison operator by using that we can compare two strings.
Here is an example:
let a = "Hola"
let b = "Hola"
let isEqual = (a == b)
print(isEqual)Output:
trueIn the example above, we have used double equals == operator to compare between string a and string and we are returning true if both are equal, otherwise we are returning false.


