| | 283 | } |
|---|
| | 284 | } |
|---|
| | 285 | if (!acceptable) { |
|---|
| | 286 | /* If the emoticon would end the string except for whitespace or newlines at the end, or it begins the string after removing |
|---|
| | 287 | * whitespace or newlines at the beginning, it is acceptable even if the previous conditions weren't met. |
|---|
| | 288 | */ |
|---|
| | 289 | NSString *trimmedString = [messageString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; |
|---|
| | 290 | unsigned int trimmedLength = [trimmedString length]; |
|---|
| | 291 | if ([trimmedString length] == (originalEmoticonLocation + textLength)) { |
|---|
| | 292 | acceptable = YES; |
|---|
| | 293 | } else if ((originalEmoticonLocation - (messageStringLength - trimmedLength)) == 0) { |
|---|
| | 294 | acceptable = YES; |
|---|