/
NSString+Emojis.h
43 lines (33 loc) · 1.08 KB
/
NSString+Emojis.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// NSString+Emojis.h
// NSStringEmojiExtension
//
// Created by Benjamin Salanki on 2018. 06. 11.
// Copyright © 2018. Totally Inappropriate Technologies. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
* @brief Category on @c NSString for finding ranges of substrings that contain emojis.
*/
@interface NSString (Emojis)
/**
* @brief Finds the ranges in the receiver that consist only of emojis.
*
* @discussion The ranges are calculated using @c NSRegularExpression.
*
* @return An array of @c NSRange values wrapped in @c NSValue objects. If there are no matches, an empty array is returned.
*/
- (nonnull NSArray<NSValue *> *)emojiRanges;
/**
* @brief Checks wether the receiver consist solely of emojis.
*
* @return @c YES, if the receiver consists only of emojis, @c NO otherwise.
*/
- (BOOL)containsOnlyEmojis;
/**
* @brief Creates a new @c NSString by stripping the emojis from the receiver.
*
* @return A new @c NSString instance with the substrings from the receiver that do not contain emojis.
*/
- (nonnull NSString *)stringByStrippingEmojis;
@end