Files
featherVoice/QXLive/Tools/Category/NSString+QX.h

184 lines
4.2 KiB
C
Raw Normal View History

2025-08-08 10:49:36 +08:00
//
// NSString+QX.h
// QXLive
//
// Created by 启星 on 2025/5/7.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSString (QX)
/**
*
**/
- (BOOL)isExist;
/**
@param number
@return
*/
+ (NSString *)effectiveNum:(double)number;
/// 当前字符串是否是数字
- (BOOL)isNumber;
/**
@param attriFont
@param attriColor
@param attriRange
@return
*/
- (NSMutableAttributedString *)getNSMutableAttributedStringWithAttriFont:(UIFont *)attriFont attriColor:(UIColor *)attriColor isline:(BOOL)isline attriBackgroundColor:(nullable UIColor *)attriBackgroundColor lineSpacing:(CGFloat)lineSpacing attriRange:(NSRange)attriRange;
/**
线
@param textColor
@param lineColor 线
@param range
@return
*/
- (NSAttributedString *)deleteLineWithTextColor: (nullable UIColor *)textColor lineColor: (nullable UIColor *)lineColor range: (NSRange)range;
- (NSAttributedString *)deleteLineWithTextColor: (nullable UIColor *)textColor lineColor: (nullable UIColor *)lineColor;
- (NSAttributedString *)deleteLineWithTextColor: (nullable UIColor *)textColor;
- (NSAttributedString *)deleteLine;
/**
@param phoneNum
@return
*/
+ (BOOL)effectivePhoneNum:(NSString *)phoneNum;
+ (BOOL)effectivePhoneNum:(NSString *)phoneNum validLength:(NSInteger)length;
/**
uuid
*/
//+ (instancetype)effectivePhoneNumeffectivePhoneNum;
/**
*
[@"y"]; // 2017
[@"yy"]; // 17
[@"yyy"]; // 2017
[@"yyyy"]; // 2017
[@"M"]; // 8
[@"MM"]; // 08
[@"MMM"]; // 8月
[@"MMMM"]; // 八月
[@"d"]; // 3
[@"dd"]; // 03
[@"D"]; // 215,一年中的第几天
[@"h"]; // 4
[@"hh"]; // 04
[@"H"]; // 16 24小时制
[@"HH"]; // 16
[@"m"]; // 28
[@"mm"]; // 28
[@"s"]; // 57
[@"ss"]; // 04
[@"E"]; // 周四
[@"EEEE"]; // 星期四
[@"EEEEE"]; // 四
[@"e"]; // 5 (显示的是一周的第几天weekday1为周日。)
[@"ee"]; // 05
[@"eee"]; // 周四
[@"eeee"]; // 星期四
[@"eeeee"]; // 四
[@"z"]; // GMT+8
[@"zzzz"]; // 中国标准时间
[@"ah"]; // 下午5
[@"aH"]; // 下午17
[@"am"]; // 下午53
[@"as"]; // 下午52
*/
//+ (NSString *)transformTimeInterval:(NSTimeInterval)sec byFormatter:(NSString *)formatter;
//
///// 今天显示9:00 昨日显示(昨天 时:分)(昨天 10:00) 其余显示(年/月/日)(2019/11/06)
///// @param sec 时间戳
//+ (NSString *)transformTodayYesterdayAndOtherTimeInterval:(NSTimeInterval)sec;
/**
key排列的URL参数格式的key=Value形式的字符串
@param dict
@return
*/
+ (NSString *)transformByAscendingWithDict:(NSDictionary *)dict;
/**
data的类型
@return content-Type
*/
+ (NSString *)contentTypeWithImageData:(NSData *)data;
/// 手机号脱敏
- (NSString *)showMoblePhoneNumber;
- (NSDictionary<NSString *,NSString *> *)parseParameters;
/// 格式化字符串的长短
/// @param limit 限制显示几个字符
/// @param suffix 超出部分的显示字符
- (NSString *)formatterToLimitNumStrWith:(NSUInteger)limit suffixStr:(nullable NSString *)suffix;
- (NSString *)formatterToLimitNumStrWith:(NSUInteger)limit;
/**
@param count
@return
*/
+ (NSString *)qx_showHotCountNum:(int64_t)count;
/// 保留两位
+ (NSString *)qx_showHotCountNumDouble:(int64_t)count ;
/**
*
*/
- (NSString *)qx_showRoomName;
/**
type == 1 00:00:00
type == 2 000000
*/
+ (NSString *)timeStrFromInterval:(long)lastTime type:(NSInteger)type;
+ (BOOL)inputShouldLetterOrNum:(NSString *)inputString;
+ (NSString *)safeString:(NSString *)string ByAppendingString:(NSString *)aString;
/**
9999w显示并保留1位小数(14500 = 1.5w)
*/
- (NSString *)tenThousandFormatString;
- (NSInteger)ageWithDateOfBirth;
/// 传入秒 得到 几天 几小时
+ (NSString*)getTimeWithSecond:(long long)second;
@end
NS_ASSUME_NONNULL_END