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
Noun | Count | Expected text | Noun ending | |
---|---|---|---|---|
Pineapple | 0 | John has no pineapples | s | |
Pineapple | 1 | John has 1 pineapple | (no) | |
Pineapple | 4 | John has 4 pineapples | s |
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
Существительное | Количество | Нужный текст | Окончание | |
---|---|---|---|---|
Pineapple | 1 | John has one pineapple | (no) | |
Pineapple | 5 | John has 5 pineapples | s | |
Pineapple | n (n != 1) | John has n pineapples | s |
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
//Objective-C | |
[NSString stringWithFormat:@"У Джона %u ананас", a]; | |
//Swift | |
String.init(format: "У Джона %u ананас", count) |
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
- (NSString *)pineappleStringWithCount:(int)count{ | |
if (count == 0) { | |
return @"У Джона нет ананасов"; | |
} | |
NSString *countString = [[NSString alloc] initWithFormat:@"%u", self.pineappleCount]; | |
if (self.pineappleCount >= 10) { |
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
int count = 0; | |
NSString *johnsPineapplesCount = nil; | |
johnsPineapplesCount = NSLocalizedString(@"johns pineapples count", nil); | |
johnsPineapplesCount = [NSString localizedStringWithFormat:johnsPineapplesCount, count]; | |
//count == 0, johnsPineapplesCount == "У Джона нет ананасов" | |
//count == 1, johnsPineapplesCount == "У Джона 1 ананас" | |
//count == 4, johnsPineapplesCount == "У Джона 4 ананаса" | |
//count == 7, johnsPineapplesCount == "У Джона 7 ананасов" |
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
int count = 0; | |
NSString *johnsPineapplesCount = nil; | |
johnsPineapplesCount = NSLocalizedString(@"johns pineapples count", nil); | |
johnsPineapplesCount = [NSString localizedStringWithFormat:johnsPineapplesCount, count]; |
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
String.init(format: "John has %u pineapple", a) |
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
Noun | Count | Expected text | Noun addition | |
---|---|---|---|---|
Pineapple | 1 | John has one pineapple | (no) | |
Pineapple | 5 | John has 5 pineapples | s | |
Pineapple | n (n != 1) | John has n pineapples | s |
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
private func pineapplesCountForEnglish(count: UInt) -> String{ | |
if count==0 { | |
return "John has no pineapples"; | |
} | |
else | |
if (count > 1) { | |
return String.init(format: "John has %u pineapples", count) |
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
Noun | Count | Expected text | Noun ending | |
---|---|---|---|---|
Ананас | 0 | У Джона нет ананасов | ов | |
Ананас | 1 | У Джона 1 ананас | (no) | |
Ананас | 4 | У Джона 4 ананаса | а | |
Ананас | 7 | У Джона 7 ананасов | ов | |
Ананас | 11 | У Джона 11 ананасов | ов | |
Ананас | 21 | У Джона 21 ананас | (no) |
OlderNewer