NSString+BBAURL.h
1.83 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
60
61
//
// NSString+BBAURL.h
// BBAFoundation
//
// Created by Zhu,Yusong on 2018/9/26.
// Copyright © 2018年 Baidu. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BDPFoundationDefines.h"
/*
* 字符串 URL 相关的扩展
* 详细介绍请看README-BBAURL
*/
@interface NSString (BBAURL)
/**
* @brief query字符串转字典, 会对querry进行反转义
*
* @return NSDictionary
*/
- (NSDictionary *)bba_queryDictionaryValue BDP_FOUNDATION_DEPRECATED("please use bdp_queryDictionary");
- (NSDictionary *)bdp_queryDictionary;
/**
* @brief 字典转query字符串,会对字典的value值进行转义
*
* @param queryDictionary 字典
* @return NSString query
*/
+ (NSString *)bba_queryStringWithDictionary:(NSDictionary *)queryDictionary BDP_FOUNDATION_DEPRECATED("please use bdp_queryStringWithDictionary:");
+ (NSString *)bdp_queryStringWithDictionary:(NSDictionary *)queryDictionary;
/**
* @brief 字符串 URL 转义
*
* @return 转义后的字符串
*
* @note This will also escape '%', so this should not be used on a string that has already been escaped unless double-escaping is the desired result.
* Encode all the reserved characters, per RFC 3986 (<http://www.ietf.org/rfc/rfc3986.txt>)
* 对应js的encodeURIComponent
*/
- (NSString *)bba_stringByEscapingForURLArgument BDP_FOUNDATION_DEPRECATED("please use bdp_encodeURIComponent");
- (NSString *)bdp_encodeURIComponent;
/**
* @brief 字符串 URL 反转义
*
* @return Returns the unescaped version of a URL argument
*
* @note This has the same behavior as stringByReplacingPercentEscapesUsingEncoding:,
* except that it will also convert '+' to space.
* 对应js的decodeURIComponent
*/
- (NSString *)bba_stringByUnescapingFromURLArgument BDP_FOUNDATION_DEPRECATED("please use bdp_decodeURIComponent");
- (NSString *)bdp_decodeURIComponent;
@end