Make 'isUnknown' method more precise

This commit is contained in:
Danny Moesch 2019-01-26 16:26:53 +01:00 committed by Mingshen Sun
parent a2edf41d33
commit e8afd251ed
2 changed files with 8 additions and 4 deletions

View file

@ -58,7 +58,8 @@ public struct Constants {
}
static func isUnknown(_ string: String) -> Bool {
return string.starts(with: UNKNOWN)
let components = string.components(separatedBy: " ")
return components.count == 2 && components[0] == UNKNOWN && UInt(components[1]) != nil
}
static func unknown(_ number: UInt) -> String {