Last active
December 26, 2015 14:19
-
-
Save davidyeiser/7165148 to your computer and use it in GitHub Desktop.
My quick and easy way to distinguish singular from plural when it comes to weather alerts.
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
// "alerts" is the array that contains the weather alerts | |
int weatherAlertsCount = alerts.count; | |
NSString *weatherAlertLabelMain = @""; | |
NSString *weatherAlertLabelMinor = @""; | |
if (weatherAlertsCount > 1) { | |
weatherAlertLabelMain = [NSString stringWithFormat:@"%d Weather Alerts", weatherAlertsCount]; | |
} | |
else { | |
weatherAlertLabelMain = [NSString stringWithFormat:@"%d Weather Alert", weatherAlertsCount]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment