NSString(FWFoundation)
@interface NSString (FWFoundation)
/// 计算单行字符串指定字体所占尺寸
- (CGSize)fw_sizeWithFont:(UIFont *)font NS_REFINED_FOR_SWIFT;
/// 计算多行字符串指定字体在指定绘制区域内所占尺寸
- (CGSize)fw_sizeWithFont:(UIFont *)font drawSize:(CGSize)drawSize NS_REFINED_FOR_SWIFT;
/// 计算多行字符串指定字体、指定属性在指定绘制区域内所占尺寸
- (CGSize)fw_sizeWithFont:(UIFont *)font drawSize:(CGSize)drawSize attributes:(nullable NSDictionary<NSAttributedStringKey, id> *)attributes NS_REFINED_FOR_SWIFT;
/// 是否匹配正则表达式,示例:^[a-zA-Z0-9_\u4e00-\u9fa5]{4,14}$
- (BOOL)fw_matchesRegex:(NSString *)regex NS_REFINED_FOR_SWIFT;
/// 格式化文件大小为".0K/.1M/.1G"
+ (NSString *)fw_sizeString:(NSUInteger)fileSize NS_REFINED_FOR_SWIFT;
@end
Undocumented
-
计算单行字符串指定字体所占尺寸
Declaration
Objective-C
- (CGSize)fw_sizeWithFont:(nonnull UIFont *)font;
-
计算多行字符串指定字体在指定绘制区域内所占尺寸
Declaration
Objective-C
- (CGSize)fw_sizeWithFont:(nonnull UIFont *)font drawSize:(CGSize)drawSize;
-
计算多行字符串指定字体、指定属性在指定绘制区域内所占尺寸
Declaration
Objective-C
- (CGSize)fw_sizeWithFont:(nonnull UIFont *)font drawSize:(CGSize)drawSize attributes:(nullable NSDictionary<NSAttributedStringKey, id> *) attributes;
-
是否匹配正则表达式,示例:^[a-zA-Z0-9_\u4e00-\u9fa5]{4,14}$
Declaration
Objective-C
- (BOOL)fw_matchesRegex:(nonnull NSString *)regex;
-
格式化文件大小为".0K/.1M/.1G"
Declaration
Objective-C
+ (nonnull NSString *)fw_sizeString:(NSUInteger)fileSize;