// // NSString+MTLimit.h // Meet // // Created by ko1o on 2018/10/22. // Copyright © 2018年 ko1o. All rights reserved. // #import NS_ASSUME_NONNULL_BEGIN @interface NSString (MTLimit) //定制化计算长度 -----两个英文字符算1个长度,中文的话默认也是1,emoj表情返回是不固定的长度 2-7 - (NSInteger)mt_customByteLength; //根据unicode判断字符串的字节个数 - (NSInteger)mt_unicodeCharacterByteLength; //根据字符所占字节数安全截断,以避免出现中文或emoj截断乱码 - (NSString *)mt_safeSubStringWithByteLength:(NSInteger)maxByteLength; //根据string.length,以避免出现中文或emoj截断乱码 - (NSString *)mt_safeSubStringWithStringLength:(NSInteger)maxLength; //是否含有emoji - (BOOL)mt_stringContainsEmoji; @end NS_ASSUME_NONNULL_END