String

In this short Swift code example, you will learn how to compare two strings despite their case sensitivity. To do that we will use the caseInsensitiveCompare() function and the ComparisonResult enumeration. Using caseInsensitiveCompare() and ComparisonResult let valueExpected = “SUCCESS” let valueProvided = “success” if valueExpected.caseInsensitiveCompare(valueProvided) == ComparisonResult.orderedSame { print(“Strings are equal”) } In the code example above, the caseInsensitiveCompare…

Read More Case Insensitive Comparison of Strings in Swift