NSCharacterset 那些事
2019-01-29 本文已影响4人
巴糖
@interface NSCharacterSet : NSObject <NSCopying, NSMutableCopying, NSSecureCoding>
/** 控制符 **/
@property (readonly, class, copy) NSCharacterSet *controlCharacterSet;
/** 前后两端的空格 **/
@property (readonly, class, copy) NSCharacterSet *whitespaceCharacterSet;
/** 空格和换行 **/
@property (readonly, class, copy) NSCharacterSet *whitespaceAndNewlineCharacterSet;
/** 小数 **/
@property (readonly, class, copy) NSCharacterSet *decimalDigitCharacterSet;
/** 文字 **/
@property (readonly, class, copy) NSCharacterSet *letterCharacterSet;
/** 小写字母 **/
@property (readonly, class, copy) NSCharacterSet *lowercaseLetterCharacterSet;
/** 大写字母 **/
@property (readonly, class, copy) NSCharacterSet *uppercaseLetterCharacterSet;
/** 非基础的所有Unicode字符 **/
@property (readonly, class, copy) NSCharacterSet *nonBaseCharacterSet;
/** 字母数字 **/
@property (readonly, class, copy) NSCharacterSet *alphanumericCharacterSet;
/** 可分解的字符集 **/
@property (readonly, class, copy) NSCharacterSet *decomposableCharacterSet;
/** 非法 **/
@property (readonly, class, copy) NSCharacterSet *illegalCharacterSet;
/** 标点 **/
@property (readonly, class, copy) NSCharacterSet *punctuationCharacterSet;
/** 大写 **/
@property (readonly, class, copy) NSCharacterSet *capitalizedLetterCharacterSet;
/** 符号字符集 **/
@property (readonly, class, copy) NSCharacterSet *symbolCharacterSet;
/** 换行符 **/
@property (readonly, class, copy) NSCharacterSet *newlineCharacterSet API_AVAILABLE(macos(10.5), ios(2.0), watchos(2.0), tvos(9.0));
@end
@interface NSCharacterSet (NSURLUtilities)
// Predefined character sets for the six URL components and subcomponents which allow percent encoding. These character sets are passed to -stringByAddingPercentEncodingWithAllowedCharacters:.
// Returns a character set containing the characters allowed in an URL's user subcomponent.("#%/:<>?@[\]^`)
@property (class, readonly, copy) NSCharacterSet *URLUserAllowedCharacterSet API_AVAILABLE(macos(10.9), ios(7.0), watchos(2.0), tvos(9.0));
// Returns a character set containing the characters allowed in an URL's password subcomponent.("#%/:<>?@[\]^`{|})
@property (class, readonly, copy) NSCharacterSet *URLPasswordAllowedCharacterSet API_AVAILABLE(macos(10.9), ios(7.0), watchos(2.0), tvos(9.0));
// Returns a character set containing the characters allowed in an URL's host subcomponent.("#%/<>?@\^`{|})
@property (class, readonly, copy) NSCharacterSet *URLHostAllowedCharacterSet API_AVAILABLE(macos(10.9), ios(7.0), watchos(2.0), tvos(9.0));
// Returns a character set containing the characters allowed in an URL's path component. ';' is a legal path character, but it is recommended that it be percent-encoded for best compatibility with NSURL (-stringByAddingPercentEncodingWithAllowedCharacters: will percent-encode any ';' characters if you pass the URLPathAllowedCharacterSet).("#%;<>?[\]^`{|})
@property (class, readonly, copy) NSCharacterSet *URLPathAllowedCharacterSet API_AVAILABLE(macos(10.9), ios(7.0), watchos(2.0), tvos(9.0));
// Returns a character set containing the characters allowed in an URL's query component.("#%<>[\]^`{|})
@property (class, readonly, copy) NSCharacterSet *URLQueryAllowedCharacterSet API_AVAILABLE(macos(10.9), ios(7.0), watchos(2.0), tvos(9.0));
// Returns a character set containing the characters allowed in an URL's fragment component. ("#%<>[\]^`{|})
@property (class, readonly, copy) NSCharacterSet *URLFragmentAllowedCharacterSet API_AVAILABLE(macos(10.9), ios(7.0), watchos(2.0), tvos(9.0));
@end