//
//  NSString+convert.h
//  ZigBeeGatewayPublic
//
//  Created by coderYK on 2018/9/5.
//  Copyright © 2018年 coderYK. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSString (convert)

- (int)rds_intValueFromHexString;

- (NSString *)rds_getBinaryFromHex;// 16进制转2进制
- (NSString *)rds_getHexByBinary;// 2进制转16进制

- (NSString *)rds_getHexFromDecimal;// 10进制转16进制
+ (NSString *)rds_getHexByDecimal:(int)decimal;
- (NSString *)rds_decimalFromHexString;// 16进制转10进制


- (NSUInteger)rds_uintegerValueFromHexString;
- (NSUInteger)rds_uintegerValueFromBinaryString;//二进制转10进制数字
- (NSInteger)rds_numberWithHexString;

- (NSString *)rds_stringTohexString; // 普通字符串转16进制
- (NSString *)rds_stringFromHexString;
- (NSString *)rds_stringFromAsciiHexString;
- (NSString *)rds_stringToAsciiHexString;// 普通字符串转换为ascii码十六进制的
- (NSString *)rds_stringToAsciiString;// 普通字符串转换为ascii码字符串
- (NSString *)rds_binaryStringReversed; // 二进制字符串逆序

- (NSArray *)rds_indexArrayFromBinaryString;
- (NSArray *)rds_indexArrayFromexIDString;
- (NSString *)rds_filterUnfitCharactor; // 过滤非汉字、字母、数字字符

- (NSString *)rds_getAsciiHexStringFromStringByte:(NSUInteger)byte; // 普通字符串转16进制并制定长度
+ (NSString *)rds_ChineseNumFrom:(NSUInteger)number; // 阿拉伯数字转汉字

- (NSString *)rds_utf8ToUnicode;

+ (NSString *)rds_stringFromDict:(NSDictionary *)dict;

- (NSData *)rds_getDataFromString;// 普通字符串 转 NSData
- (NSData *)rds_getDataFromHexString;// 16进制转 NSData

+ (NSString *)rds_getHexStringFromData:(NSData *)data;// NSData 转 16进制
+ (NSString *)rds_getHexStringFromNSData:(NSData *)data;// NSData 转 16进制
+ (NSString *)rds_getStringFromData:(NSData *)data;// data 转字符串

/// 大端转成小段
- (NSString *)rds_changeLittleEndian;

/// 字符串后补f
- (NSString *)addZeroWithLength:(int)length;

/// 首字母大写
- (NSString *)rds_changeFistUppercase;

+ (NSString*)rds_dicToJson:(NSDictionary *)dic;
+ (NSDictionary *)rds_jsonToDic:(NSString *)json;
@end
