[Previous]
[Up]
[Next]
NSString
Authors
- Richard Frith-Macdonald
-
- James Dessart
-
Version: 0.1
Date: 28 February, 2000
Declared in: Foundation/NSString.h
Inherits from: NSObject
Conforms to: NSCoding
NSString objects represent an immutable string of characters. NSString itself is an
abstract class which provides factory methods to generate objects of unspecified
subclasses.
A constant NSString can be created using the following syntax: @"..."
,
where the contents of the quotes are the string, using only ASCII characters.
+ (const NSStringEncoding*) availableStringEncodings;
Returns an array of all available string encodings, terminated by a null value.
+ (NSStringEncoding) defaultCStringEncoding;
Returns the encoding used for any method accepting a C string.
+ (NSString*) localizedNameOfStringEncoding: (NSStringEncoding)encoding;
Returns the localized name of the encoding specified by encoding.
+ (NSString*) localizedStringWithFormat: (NSString*)format,;
+ (NSString*) pathWithComponents: (NSArray*)components;
+ (id) string;
+ (id) stringWithCharacters: (const unichar*)chars length: (unsigned int)length;
+ (id) stringWithContentsOfFile: (NSString*)path;
+ (id) stringWithCString: (const char*)cString;
+ (id) stringWithCString: (const char*)cString;
+ (id) stringWithFormat: (NSString*)format,;
+ (id) stringWithString: (NSString*)aString;
- (BOOL) canBeConvertedToEncoding: (NSStringEncoding)encoding;
- (NSString*) capitalizedString;
- (NSComparisonResult) caseInsensitiveCompare: (NSString*)aString;
- (unichar) characterAtIndex: (unsigned int)index;
- (NSString*) commonPrefixWithString: (NSString*)aString;
- (NSComparisonResult) compare: (NSString*)aString;
- (NSComparisonResult) compare: (NSString*)aString;
- (NSComparisonResult) compare: (NSString*)aString options: (unsigned int)mask range: (NSRange)aRange;
- (unsigned int) completePathIntoString: (NSString**)outputName caseSensitive: (BOOL)flag matchesIntoArray: (NSArray**)outputArray;
- (NSArray*) componentsSeparatedByString: (NSString*)separator;
- (const char*) cString;
- (unsigned int) cStringLength;
- (NSData*) dataUsingEncoding: (NSStringEncoding)encoding;
- (NSData*) dataUsingEncoding: (NSStringEncoding)encoding allowLossyConversion: (BOOL)flag;
- (NSString*) description;
- (double) doubleValue;
- (NSStringEncoding) fastestEncoding;
- (const char*) fileSystemRepresentation;
- (float) floatValue;
- (void) getCharacters: (unichar*)buffer;
- (void) getCharacters: (unichar*)buffer;
- (void) getCString: (char*)buffer;
- (void) getCString: (char*)buffer maxLength: (unsigned int)maxLength;
- (void) getCString: (char*)buffer maxLength: (unsigned int)maxLength range: (NSRange)aRange remainingRange: (NSRange*)leftoverRange;
- (BOOL) getFileSystemRepresentation: (char*)buffer maxLength: (unsigned int)maxLength;
+ (void) getLineStart: (unsigned int*)startIndex end: (unsigned int*)lineEndIndex contentsEnd: (unsigned int*)contentsEndIndex;
- (unsigned int) hash;
- (BOOL) hasPrefix: (NSString*)aString;
- (BOOL) hasSuffix: (NSString*)aString;
- (id) init;
- (id) initWithCharacters: (const unichar*)characters;
- (id) initWithCharactersNoCopy: (unichar*)characters length: (unsigned int)length freeWhenDone: (BOOL)flag;
- (id) initWithContentsOfFile: (NSString*)path;
- (id) initWithCString: (const char*)cString;
- (id) initWithCString: (const char*)cString;
- (id) initWithCStringNoCopy: (char*)cString length: (unsigned int)length freeWhenDone: (BOOL)flag;
- (id) initWithData: (NSData*)data encoding: (NSStringEncoding)encoding;
- (id) initWithFormat: (NSString*)format,;
- (id) initWithFormat: (NSString*)format arguments: (va_list)argList;
- (id) initWithFormat: (NSString*)format;
- (id) initWithFormat: (NSString*)format locale: (NSDictionary*)dictionary arguments: (va_list)argList;
- (id) initWithString: (NSString*)aString;
- (int) intValue;
- (BOOL) isAbsolutePath;
- (BOOL) isEqualToString: (NSString*)aString;
- (NSString*) lastPathComponent;
- (unsigned int) length;
+ (NSRange) lineRangeForRange: (NSRange)aRange;
- (const char*) lossyCString;
- (NSString*) lowercaseString;
- (NSArray*) pathComponents;
- (NSString*) pathExtension;
- (id) propertyList;
- (NSDictionary*) propertyListFromStringsFileFormat;
- (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet;
- (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet options: (unsigned int)mask;
- (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet options: (unsigned int)mask range: (NSRange)aRange;
- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (unsigned int)anIndex;
- (NSRange) rangeOfString: (NSString*)aString;
Invokes rangeOfString:options: with the options mask
set to zero.
- (NSRange) rangeOfString: (NSString*)aString options: (unsigned int)mask;
Invokes rangeOfString:options:range with the range set
set to the range of the whole of the reciever.
- (NSRange) rangeOfString: (NSString*)subString options: (unsigned int)mask range: (NSRange)aRange;
Returns the range giving the location and length of the first
occurrence of subString within aRange.
If subString does not exist in the receiver (an empty
string is never considered to exist in the receiver),
the length of the returned range is zero.
If substring is nil, an exception is raised.
If any part of aRange lies outside the range of the
receiver, an exception is raised.
The optionsm mask may contain the following options -
- NSCaseInsensitiveSearch
- NSLiteralSearch
- NSBackwardsSearch
- NSAnchoredSearch
- (NSStringEncoding) smallestEncoding;
- (NSString*) stringByAbbreviatingWithTildeInPath;
- (NSString*) stringByAppendingFormat: (NSString*)format,;
- (NSString*) stringByAppendingPathComponent: (NSString*)aString;
- (NSString*) stringByAppendingPathExtension: (NSString*)string;
- (NSString*) stringByAppendingString: (NSString*)aString;
- (NSString*) stringByDeletingLastPathComponent;
- (NSString*) stringByDeletingPathExtension;
- (NSString*) stringByExpandingTildeInPath;
- (NSString*) stringByReplacingString: (NSString*)aString withString: (NSString*)replacement;
Standards: GNUstep NotMacOS-X NotOpenStep
Returns a string in which any (and all) occurrances of
aString in the receiver have been replaced by
replacement. Returns the receiver if aString
does not occur within the receiver. NB. an empty string is
not considered to exist within the receiver.
- (NSArray*) stringsByAppendingPaths: (NSArray*)paths;
- (NSString*) substringFromIndex: (unsigned int)anIndex;
- (NSString*) substringToIndex: (unsigned int)anIndex;
- (NSString*) substringWithRange: (NSRange)aRange;
- (NSString*) uppercaseString;
- (BOOL) writeToFile: (NSString*)path atomically: (BOOL)flag;