Created
October 21, 2018 08:31
-
-
Save katleta3000/51f8f9704ca2a7211cfe4831208abd14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func compareVersion(version1: String, version2: String) { | |
let result = version1.compare(version2, options: .numeric) | |
if result == .orderedDescending { | |
print("\(version1) > \(version2)") | |
} else if result == .orderedAscending { | |
print("\(version1) < \(version2)") | |
} else { | |
print("\(version1) == \(version2)") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment