iOS NSStringの一般的な方法
2445 ワード
NSStringの一般的な方法
// path , enc, error
+ (id)stringWithContentsOfURL:(NSURL *)url encoding:(NSStringEncoding)enc error:(NSError **)error;
// url , enc, error
+ (id)stringWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)enc error:(NSError **)error;
//
+(id)string;
// , string
+ (id)stringWithString:(NSString *)string;
// astring
- (id)initWithString:(NSString *)aString;
// path enc, error
- (id)initWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)enc error:(NSError **)error;
// path enc, error
- (id)initWithContentsOfURL:(NSURL *)url encoding:(NSStringEncoding)enc error:(NSError **)error;
//
- (NSUInteger)length;
// ( , i) Unicode
- (unichar)characterAtIndex:(NSUInteger)index;
// (?)
- (NSString *)substringFromIndex:(NSUInteger)from;
// (?)
- (NSString *)substringToIndex:(NSUInteger)to;
//
- (NSString *)substringWithRange:(NSRange)range;
// ( )
- (NSComparisonResult)caseInsensitiveCompare:(NSString *)string;
//
- (NSComparisonResult)localizedCompare:(NSString *)string;
// aString
- (BOOL)hasPrefix:(NSString *)aString;
// aString
- (BOOL)hasSuffix:(NSString *)aString;
//
- (BOOL)isEqualToString:(NSString *)aString;
// ,
- (NSString *)capitalizedString;
//
- (NSString *)lowercaseString;
//
- (NSString *)uppercaseString;
// UTF8
- (__strong const char *)UTF8String;
// double
- (double)doubleValue;
// float
- (float)floatValue;
// int
- (int)intValue;
// NSInteger
- (NSInteger)integerValue;