// // FLStringHelper.h // FirstLink // // Created by unicode on 14-9-25. // Copyright (c) 2014年 FirstLink. All rights reserved. // #import #import @interface NSString (MyAdditions) - (NSString *)md5; @end @interface FLStringHelper : NSObject + (NSString*)convertNumberToString:(int)num; + (CGRect)rectOfString:(NSString*)text font:(UIFont*)font width:(CGFloat)width; + (CGRect)rectOfString:(NSString*)text font:(UIFont*)font height:(CGFloat)height; + (CGSize)sizeOfAttributeString:(NSString*)text font:(UIFont*)font width:(CGFloat)width maxRow:(int)maxRow; + (CGSize)sizeOfAttributeString:(NSString*)text lineSpace:(CGFloat)lineSpace width:(CGFloat)width font:(UIFont *)font maxRow:(NSInteger)maxRow; + (NSString*)replaceNilWithEmpty:(NSString*)string; + (NSString*)convertFenToYuan:(NSString*)fen; + (CGFloat)convertFenStringToYuanValue:(NSString *)fenStr; + (NSString *)convertFenToRMBmoneyString:(NSString*)fen; + (NSString*)convertStringToTipTime:(NSString*)time; + (NSString*)convertStringToTipTime:(NSString*)time formate:(NSString *)formate; + (NSString*)dateForMessage:(NSDate*)date; + (NSString*)convertDate:(NSDate*)date formate:(NSString*)formate; + (NSString*)cdnParamaterString:(int)width; + (NSString*)cdnParamaterString:(int)width height:(int)height; + (NSString*)componentOfDay:(NSString*)time; + (NSDateFormatter *)dateFormat; + (NSDate *)convertToDateFromString:(NSString *)string; + (NSDate *)convertToShortDateFromString:(NSString *)string; + (NSString *)convertDictionary2String:(NSDictionary *)dict; // 转化字符串为年月日格式 + (NSString *)convertToShortDateStringFromString:(NSString *)timeString; // 将倒计时(秒)转为剩余天时分秒字符串 + (NSString *)convertTimeIntervalToCountString:(NSTimeInterval)timeInterval; // 将倒计时(秒)转为剩余时分秒字符串 + (NSString *)convertTimeIntervalToHourCountString:(NSTimeInterval)timeInterval; // 将倒计时(秒)转为剩余时:分:秒字符串 + (NSString *)convertTimeIntervalToHourCountStringStyleColon:(NSTimeInterval)timeInterval; + (NSTimeInterval)timeIntervalFromString:(NSString *)dateString; // 转化字符串为日期显示样式(超过24H,2015-2-3, 24H内:5小时前,1h内:45分钟前) + (NSString *)convertToPredigestStringFromString:(NSString *)timeString; // 和本地时间比较 + (NSString *)convertToPredigestStringFromString:(NSString *)timeString baseTime:(NSDate *)baseTime; // 和指定时间比较,如果baseTime为nil 同上 + (NSString *)convertToPredigestStringFromTimeInterval:(NSTimeInterval)timeInterval shortTimeStr:(NSString *)shortTimeStr; // 转化为日期样式(09-12, 省去年份) + (NSString *)convertToTimeStrNoYear:(NSString *)timeStr; // 转化为日期样式(09-12, 5小时前, 45分钟前,刚刚) + (NSString *)convertToCommonFormateFromString:(NSString *)timeString baseTime:(NSString *)baseTime; + (NSDateComponents *)convertToComponentsFormateFromString:(NSString *)timeString baseTime:(NSString *)baseTime; + (NSDateComponents*)convertSecondToComponents:(NSTimeInterval)second baseTime:(NSString *)baseTime; + (NSDateComponents*)convertSecondToComponents:(NSTimeInterval)second; + (BOOL)isUrlString:(NSString *)string; // 是否是链接 + (BOOL)isValidString:(NSString *)string; // 是否有效字符串,非空 + (NSAttributedString *)attStringWithText:(NSString *)text color:(UIColor *)color font:(UIFont *)font lineSpace:(CGFloat)lineSpace; + (NSAttributedString *)attStringWithText:(NSString *)text lineSpace:(CGFloat)lineSpace; + (NSAttributedString *)attStringWithText:(NSString *)text color:(UIColor *)color font:(UIFont *)font subText:(NSString *)subText subColor:(UIColor *)subColor subFont:(UIFont *)subFont; + (id)convertStringToJson:(NSString *)string; + (NSString *)jsonStrWithDict:(NSDictionary *)dict; // 数字处理 (不大于1W,显示9999 过1w 显示1万,不超过2W,显示1万), 不处理负数 + (NSString *)convertToShortNumStr:(NSInteger)count; @end