Case Insensitive Comparison of Strings in Swift

This short Swift code example will demonstrate how to do case insensitive string comparison in Swift.

  
        let valueExpected = "SUCCESS"
        let valueProvided = "success"
        
        if valueExpected.caseInsensitiveCompare(valueProvided) == ComparisonResult.orderedSame
        {
            print("Strings are equal")
        }

Check out many other practical code examples in Swift.

[raw_html_snippet id=”cookbookpagecoursesheader”]

Unit Testing Swift Mobile App

Apply Test-Driven Development(TDD) process to iOS mobile app development in Swift Preview this video course.