NSCharacterset 和NSString
来源:互联网 发布:海量数据上市 编辑:程序博客网 时间:2024/05/16 18:35
IOS 官方文档对NSCharacterset 的介绍
An NSCharacterSet object represents a set of Unicode-compliant characters.NSString and NSScanner objects useNSCharacterSet objects to group characters together for searching operations, so that they can find any of a particular set of characters during a search. The cluster’s two public classes,NSCharacterSet and NSMutableCharacterSet, declare the programmatic interface for static and dynamic character sets, respectively.
The objects you create using these classes are referred to as character set objects (and when no confusion will result, merely as character sets). Because of the nature of class clusters, character set objects aren’t actual instances of theNSCharacterSet or NSMutableCharacterSet classes but of one of their private subclasses. Although a character set object’s class is private, its interface is public, as declared by these abstract superclasses,NSCharacterSet and NSMutableCharacterSet. The character set classes adopt theNSCopying and NSMutableCopying protocols, making it convenient to convert a character set of one type to the other.
The NSCharacterSet class declares the programmatic interface for an object that manages a set of Unicode characters (see theNSString class cluster specification for information on Unicode).NSCharacterSet’s principal primitive method, characterIsMember:, provides the basis for all other instance methods in its interface. A subclass ofNSCharacterSet needs only to implement this method, plus mutableCopyWithZone:, for proper behavior. For optimal performance, a subclass should also overridebitmapRepresentation, which otherwise works by invoking characterIsMember: for every possible Unicode value.
NSCharacterSet is “toll-free bridged” with its Core Foundation counterpart,CFCharacterSetRef. See “Toll-Free Bridging” for more information on toll-free bridging.
The mutable subclass of NSCharacterSet isNSMutableCharacterSet.
我们在nsstring的分割,查找等操作中,经常会提供两种函数,参数类型分别为NSString 和NSCharacterset,有什么不同呢?
NSString 是有序字符串
NSCharacterset是无需字符集合,主要用来判断已知字符串是否包含制定字符集,而不可以用来保存字符串。
- NSCharacterset 和NSString
- NSCharacterSet 去除NSString中的空格
- ios开发答疑录系列---(五)NSString 和NSCharacterset的不同之处
- NSString中提取单词 enumerateSubstringsInRange NSCharacterSet CFStringTokenizerRef
- NSCharacterSet
- NSCharacterSet
- NSCharacterSet
- ios,object-c,iphone, NSCharacterSet 去除NSString中的空格
- NSString新用法 字符串_过滤处理NSCharacterSet 与invertedSet
- NSString新用法 字符串_过滤处理NSCharacterSet 与invertedSet
- NSCharacterSet使用方法
- NSCharacterSet stringByTrimmingCharactersInSet
- NSCharacterSet使用方法
- NSCharacterSet NSMutableCharacterSet
- NSCharacterSet stringByTrimmingCharactersInSet
- NSCharacterSet 介绍
- NSCharacterSet 详解
- NSString 和NSData
- PreparedStatement的用法
- 如何更改js的alert样式
- Java中Annotation(注释)系列学习笔记(1)
- 白话经典算法系列之七 堆与堆排序
- ubuntu10.04编译android4.0.3的要点
- NSCharacterset 和NSString
- 缺陷管理工具 ALM -- Change Request
- Java中Annotation(注释)系列学习笔记(2)
- C#程序删除自身
- python 关于文件的一些操作
- RHEL_6.0 GCC安装
- android -- WatchDog看门狗分析
- Install the Legato Networker client on Solaris 10
- Oracle SQL trace 不同level 的区别