-
Notifications
You must be signed in to change notification settings - Fork 0
/
JWBlueDataChangeTool.h
73 lines (52 loc) · 1.64 KB
/
JWBlueDataChangeTool.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// JWBlueDataChangeTool.h
// SmartAudio
//
// Created by 陈经纬 on 2018/4/8.
// Copyright © 2018年 new4545. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface JWBlueDataChangeTool : NSObject
/**
将传入的NSData类型转换成NSString并返回
eg:收到的数据:<01d4d4d4 01d4d4d4 3d3d3d>
需要转成 01d4d4d401d4d4d43d3d3d
*/
+ (NSString*)hexadecimalString:(NSData *)data;
/**
将传入的NSString(10进制)类型转换成NSData并返回(格式: xxxxxxxx)
eg:将数字64 转为两位的NSData格式 00 40
NSData *data = [JWBlueDataChangeTool dataWithInt:64 andLength:2];
*/
+ (NSData *)dataWithInt:(NSInteger)integer andLength:(int)len;
/**
将传入的NSString(16进制)类型转换成NSData并返回(格式: xxxxxxxx)
*/
+ (NSData*)dataWithHexstring:(NSString *)hexstring;
/**
将传入的NSString(10进制)类型转换成NSData并返回(格式: xxxxxxxx)
*/
+ (NSData*)dataWithIntString:(NSString *)intString;
/**
字符串以ASCII编码格式解码
@param ASCIIString 45312e30
@return 字符串
*/
+ (NSString *)stringWithASCII:(NSString *)ASCIIString;
/**
删除字符串里面的某个字符
@param string <#string description#>
@param str <#str description#>
@return <#return value description#>
*/
+ (NSString *)deleteString:(NSString *)string withDeletStr:(NSString *)str;
#pragma mark - 进制转化
/**
十六进制转十进制字符串
*/
+ (NSInteger )numberWithHexString:(NSString *)hexString;
/**二进制转十进制*/
+ (NSString *)toDecimalSystemWithBinarySystem:(NSString *)binary;
/*将十进制转化为十六进制*/
+ (NSString *)ToHex:(int)tmpid;
@end