NSString+BBANumber.h
1.29 KB
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
//
// NSString+BBACheckString.h
// BBAFoundation
//
// Created by Zhu,Yusong on 2018/9/19.
// Copyright © 2018年 Baidu. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BDPFoundationDefines.h"
/**
* 判断字符是否属于数字或包含数字,并提供安全的转换方法
* 详细介绍请看README-BBAString
*/
@interface NSString (BBANumber)
/**
* @brief 判断字符串是否是数字类型
*
* @return BOOL
*/
- (BOOL)bba_isNumber BDP_FOUNDATION_DEPRECATED("please use bdp_isNumber");
- (BOOL)bdp_isNumber;
/**
* @brief 判断字符串是否是整数(int)
*
* @return BOOL
*/
- (BOOL)bba_isInteger BDP_FOUNDATION_DEPRECATED("please use bdp_isInteger");
- (BOOL)bdp_isInteger;
/**
* @brief 判断字符串是否是浮点数(float)
*
* @return BOOL
*/
- (BOOL)bba_isFloat BDP_FOUNDATION_DEPRECATED("please use bdp_isFloat");
- (BOOL)bdp_isFloat;
/**
* @brief 判断字符串是否是纯数字(只有0-9)
*
* @return BOOL
*/
- (BOOL)bba_isDigit BDP_FOUNDATION_DEPRECATED("please use bdp_isDigit");
- (BOOL)bdp_isDigit;
/**
* @brief 将字符串转换成 NSNumber 的安全方法
*
* @return NSNumber 若字符串不为数字类型 返回 nil
*/
- (NSNumber *)bba_numberValue BDP_FOUNDATION_DEPRECATED("please use bdp_numberValue");
- (NSNumber *)bdp_numberValue;
@end