NSNotFound

定义一个值,用于指示请求项找不到或不存在。
Defines a value that indicates that an item requested couldn’t be found or doesn’t exist.

enum { NSNotFound = NSIntegerMax};

NSEnumerationOptions

块枚举操作的选项。
Options for Block enumeration operations.

enum { NSEnumerationConcurrent = (1UL << 0), NSEnumerationReverse = (1UL << 1),};typedef NSUInteger NSEnumerationOptions;

Options:位枚举

 NSString *str = @"abc";
NSString *str1 = @"Abc";
// 比较的时候不区分大小写
NSComparisonResult result = [str compare:str1 options:NSCaseInsensitiveSearch|];
switch (result) {
case NSOrderedAscending:
NSLog(@"str < str1,升序");
break;
case NSOrderedDescending:
NSLog(@"str > str1,降序");
break;
case NSOrderedSame:
NSLog(@"str == str1,");
break;
default:
break;
        NSString *str = @"abc";
NSString *str1 = @"ab";
// 比较的时候不区分大小写和根据个数
NSComparisonResult result = [str compare:str1 options:NSCaseInsensitiveSearch|NSNumericSearch];
switch (result) {
case NSOrderedAscending:
NSLog(@"str < str1,升序");
break;
case NSOrderedDescending:
NSLog(@"str > str1,降序");
break;
case NSOrderedSame:
NSLog(@"str == str1,");
break;
default:
break;

NSComparisonResult

这些常量用于指示请求中的条目如何排序。
These constants are used to indicate how items in a request are ordered.

enum {
NSOrderedAscending = -1, -1 升序
NSOrderedSame, 0 降序
NSOrderedDescending 1 ==
};
typedef NSInteger NSComparisonResult;
        NSString *str = @"abc";
NSString *str1 = @"abd";
NSComparisonResult result = [str compare:str1];
switch (result) {
case NSOrderedAscending:
NSLog(@"str < str1,升序");
break;
case NSOrderedDescending:
NSLog(@"str > str1,降序");
break;
case NSOrderedSame:
NSLog(@"str == str1,");
break;
default:
break;
 

NSSortOptions

块排序操作的选项。
Options for Block sorting operations.

struct NSSortOptions : RawOptionSetType {
init(_ rawValue: UInt)
init(rawValue rawValue: UInt)
static var Concurrent: NSSortOptions { get }
static var Stable: NSSortOptions { get }
}
enum { NSSortConcurrent = (1UL << 0), NSSortStable = (1UL << 4),};typedef NSUInteger NSSortOptions;

NSSearchPathDirectory

这些常量指定了各种目录位置,用于方法 URLsForDirectory:inDomains: 和 URLForDirectory:inDomain:appropriateForURL:create:error: NSFileManager 。
These constants specify the location of a variety of directories by the URLsForDirectory:inDomains: andURLForDirectory:inDomain:appropriateForURL:create:error: NSFileManager methods.

enum {	NSApplicationDirectory = 1,	NSDemoApplicationDirectory,	NSDeveloperApplicationDirectory,	NSAdminApplicationDirectory,	NSLibraryDirectory,	NSDeveloperDirectory,	NSUserDirectory,	NSDocumentationDirectory,	NSDocumentDirectory,	NSCoreServiceDirectory,	NSAutosavedInformationDirectory = 11,	NSDesktopDirectory = 12,	NSCachesDirectory = 13,	NSApplicationSupportDirectory = 14,	NSDownloadsDirectory = 15,	NSInputMethodsDirectory = 16,	NSMoviesDirectory = 17,	NSMusicDirectory = 18,	NSPicturesDirectory = 19,	NSPrinterDescriptionDirectory = 20,	NSSharedPublicDirectory = 21,	NSPreferencePanesDirectory = 22,	NSItemReplacementDirectory = 99,	NSAllApplicationsDirectory = 100,	NSAllLibrariesDirectory = 101,};typedef NSUInteger NSSearchPathDirectory;

NSInteger and NSUInteger Maximum and Minimum Values

代表 NSInteger 和 NSUInteger 的最大值和最小值的常量。
Constants representing the maximum and minimum values of NSInteger and NSUInteger.

#define NSIntegerMaxLONG_MAX#define NSIntegerMinLONG_MIN #define NSUIntegerMax ULONG_MAX

2、基础数据类型参考 Foundation Data Types Reference (以下仅选出常用的部分,完整列表可点击此行标题转入官网链接)

NSInteger

用于描述一个整型。(这个不是一个类,而是一个宏定义,是 C 长整型的别名)
Used to describe an integer.

typedef long NSInteger;

NSUInteger

用于描述一个无符号整型。(这个也不是一个类,而是一个宏定义,是 C 无符号长整型的别名)
Used to describe an unsigned integer.

typedef unsigned long NSUInteger;

NSTimeInterval

用于指定一个时间间隔,单位 秒。
Used to specify a time interval, in seconds.
以下这句原文,后半句关于毫秒部分的精度,没太明白,有懂得帮准确翻译一下,在此谢过。
NSTimeInterval is always specified in seconds; it yields sub-millisecond precision over a range of 10,000 years.

typedef double NSTimeInterval;

NSUncaughtExceptionHandler

用于处理异常处理域之外的异常。也即系统无法捕获的异常,配合 XCode 做异常跟踪很有用处。
Used for the function handling exceptions outside of an exception-handling domain.

typedef volatile void NSUncaughtExceptionHandler(NSException *exception);

NSStringEncoding

该类型代表字符串编码值。
Type representing string-encoding values.

typedef NSUInteger NSStringEncoding;

String Encodings

以下常量由 NSString 提供,作用可用的字符串编码。
The following constants are provided by NSString as possible string encodings.

enum { NSASCIIStringEncoding = 1,
。。。 NSUTF8StringEncoding = 4,
。。。 NSUnicodeStringEncoding = 10,
。。。 NSProprietaryStringEncoding = 65536};

以上节选一部分常用的,从上面的链接,可以查看苹果官方文档完整部分。

但是,你会发现没有 GB2312、GBK 等编码,这个可以通过核心基础框架来解决,在基础框架中并未提供相应的编码。

CFStringConvertEncodingToNSStringEncoding

Returns the Cocoa encoding constant that maps most closely to a given Core Foundation encoding constant.

unsigned long CFStringConvertEncodingToNSStringEncoding ( CFStringEncoding encoding);

CFStringConvertNSStringEncodingToEncoding

Returns the Core Foundation encoding constant that is the closest mapping to a given Cocoa encoding.

CFStringEncoding CFStringConvertNSStringEncodingToEncoding ( unsigned long encoding);

CFStringEncoding

An integer type for constants used to specify supported string encodings in various CFString functions.

typedef UInt32 CFStringEncoding;

External String Encodings

CFStringEncoding 常量用于可能被 CFString 支持的编码。
CFStringEncoding
 constants for encodings that may be supported by CFString.

enum {	。。。	kCFStringEncodingGB_2312_80 = 0x0630,	kCFStringEncodingGBK_95 = 0x0631,	kCFStringEncodingGB_18030_2000 = 0x0632,	。。。	kCFStringEncodingBig5 = 0x0A03,	。。。	kCFStringEncodingHZ_GB_2312 = 0x0A05,	。。。};
kCFStringEncodingGB_18030_2000 是 GB 编码的最大集合,可以使用这个,用如下方式:
NSStringEncoding gbencoding = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);

最新文章

  1. CentOS x64上Matlab R2015b的镜像安装方法与卸载
  2. [译]git pull
  3. 二级菜单jquery
  4. 【转载】C++——CString用法大全
  5. C#反射技术的相关使用方法
  6. Control character in cookie value, consider BASE64 encoding your value
  7. Unity Rigidbody 刚体中的Angular Drag和Freeze Position/Rotation
  8. 《Programming WPF》翻译 第9章 2.选择一个基类
  9. 从一道数学题弹程序员的思维:数学题,求证:(a+b%c)%c=(a+b)%c
  10. 分页加载的Fragment
  11. G面经: Design Stock Price Display System
  12. mysql:数据库备份方案
  13. NAT穿越(一) NAT类型
  14. sharc dsp 学习记录1---2014-07-30
  15. linux --- 4. 虚拟环境
  16. ASP.NET 压缩输出的HTML字符
  17. Django 定义数据模型
  18. stenciljs 学习七 路由
  19. CF543E Listening to Music
  20. 钉钉开发笔记(三)MySQL的配置

热门文章

  1. 使用回车键代替TAB键 需jquery1.4.2版本
  2. 本图片处理类功能非常之强大可以实现几乎所有WEB开发中对图像的处理功能都集成了,包括有缩放图像、切割图像、图像类型转换、彩色转黑白、文字水印、图片水印等功能
  3. magento app开发遇到的问题及解决
  4. python实现动态更新远程机器列表的SSH登录脚本
  5. XML标签
  6. &lt;Interview problem&gt;二进制加法
  7. Balanced Lineup(树状数组 POJ3264)
  8. 提高mysql插入性能
  9. ACID
  10. GZFramwork数据库层《二》单据表增删改查(自动生成单据号码)