How to check if the content of a NSString is an integer value? Is there any readily available way?
There got to be some better way then doing something like this:
func getPositive(input: String) -> String { if (input.count <= 0) || (input.rangeOfCharacter(from: NSCharacterSet.decimalDigits.inverted) != nil) { return "This is NOT a positive integer" } return "YES! integer" }
Update @coco's answer for Swift 5