[Previous] [Up] [Next]

NSString

Authors

Richard Frith-Macdonald
James Dessart

Version: 0.1

Date: 28 February, 2000

NSString

NSString

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.


availableStringEncodings

+ (const NSStringEncoding*) availableStringEncodings;

Returns an array of all available string encodings, terminated by a null value.


defaultCStringEncoding

+ (NSStringEncoding) defaultCStringEncoding;

Returns the encoding used for any method accepting a C string.


localizedNameOfStringEncoding:

+ (NSString*) localizedNameOfStringEncoding: (NSStringEncoding)encoding;

Returns the localized name of the encoding specified by encoding.


localizedStringWithFormat:

+ (NSString*) localizedStringWithFormat: (NSString*)format,;

pathWithComponents:

+ (NSString*) pathWithComponents: (NSArray*)components;

string

+ (id) string;

stringWithCharacters:length:

+ (id) stringWithCharacters: (const unichar*)chars length: (unsigned int)length;

stringWithContentsOfFile:

+ (id) stringWithContentsOfFile: (NSString*)path;

stringWithCString:

+ (id) stringWithCString: (const char*)cString;

stringWithCString:

+ (id) stringWithCString: (const char*)cString;

stringWithFormat:

+ (id) stringWithFormat: (NSString*)format,;

stringWithString:

+ (id) stringWithString: (NSString*)aString;

canBeConvertedToEncoding:

- (BOOL) canBeConvertedToEncoding: (NSStringEncoding)encoding;

capitalizedString

- (NSString*) capitalizedString;

caseInsensitiveCompare:

- (NSComparisonResult) caseInsensitiveCompare: (NSString*)aString;

characterAtIndex:

- (unichar) characterAtIndex: (unsigned int)index;

commonPrefixWithString:

- (NSString*) commonPrefixWithString: (NSString*)aString;

compare:

- (NSComparisonResult) compare: (NSString*)aString;

compare:

- (NSComparisonResult) compare: (NSString*)aString;

compare:options:range:

- (NSComparisonResult) compare: (NSString*)aString options: (unsigned int)mask range: (NSRange)aRange;

completePathIntoString:caseSensitive:matchesIntoArray:

- (unsigned int) completePathIntoString: (NSString**)outputName caseSensitive: (BOOL)flag matchesIntoArray: (NSArray**)outputArray;

componentsSeparatedByString:

- (NSArray*) componentsSeparatedByString: (NSString*)separator;

cString

- (const char*) cString;

cStringLength

- (unsigned int) cStringLength;

dataUsingEncoding:

- (NSData*) dataUsingEncoding: (NSStringEncoding)encoding;

dataUsingEncoding:allowLossyConversion:

- (NSData*) dataUsingEncoding: (NSStringEncoding)encoding allowLossyConversion: (BOOL)flag;

description

- (NSString*) description;

doubleValue

- (double) doubleValue;

fastestEncoding

- (NSStringEncoding) fastestEncoding;

fileSystemRepresentation

- (const char*) fileSystemRepresentation;

floatValue

- (float) floatValue;

getCharacters:

- (void) getCharacters: (unichar*)buffer;

getCharacters:

- (void) getCharacters: (unichar*)buffer;

getCString:

- (void) getCString: (char*)buffer;

getCString:maxLength:

- (void) getCString: (char*)buffer maxLength: (unsigned int)maxLength;

getCString:maxLength:range:remainingRange:

- (void) getCString: (char*)buffer maxLength: (unsigned int)maxLength range: (NSRange)aRange remainingRange: (NSRange*)leftoverRange;

getFileSystemRepresentation:maxLength:

- (BOOL) getFileSystemRepresentation: (char*)buffer maxLength: (unsigned int)maxLength;

getLineStart:end:contentsEnd:

+ (void) getLineStart: (unsigned int*)startIndex end: (unsigned int*)lineEndIndex contentsEnd: (unsigned int*)contentsEndIndex;

hash

- (unsigned int) hash;

hasPrefix:

- (BOOL) hasPrefix: (NSString*)aString;

hasSuffix:

- (BOOL) hasSuffix: (NSString*)aString;

init

- (id) init;

initWithCharacters:

- (id) initWithCharacters: (const unichar*)characters;

initWithCharactersNoCopy:length:freeWhenDone:

- (id) initWithCharactersNoCopy: (unichar*)characters length: (unsigned int)length freeWhenDone: (BOOL)flag;

initWithContentsOfFile:

- (id) initWithContentsOfFile: (NSString*)path;

initWithCString:

- (id) initWithCString: (const char*)cString;

initWithCString:

- (id) initWithCString: (const char*)cString;

initWithCStringNoCopy:length:freeWhenDone:

- (id) initWithCStringNoCopy: (char*)cString length: (unsigned int)length freeWhenDone: (BOOL)flag;

initWithData:encoding:

- (id) initWithData: (NSData*)data encoding: (NSStringEncoding)encoding;

initWithFormat:

- (id) initWithFormat: (NSString*)format,;

initWithFormat:arguments:

- (id) initWithFormat: (NSString*)format arguments: (va_list)argList;

initWithFormat:

- (id) initWithFormat: (NSString*)format;

initWithFormat:locale:arguments:

- (id) initWithFormat: (NSString*)format locale: (NSDictionary*)dictionary arguments: (va_list)argList;

initWithString:

- (id) initWithString: (NSString*)aString;

intValue

- (int) intValue;

isAbsolutePath

- (BOOL) isAbsolutePath;

isEqualToString:

- (BOOL) isEqualToString: (NSString*)aString;

lastPathComponent

- (NSString*) lastPathComponent;

length

- (unsigned int) length;

lineRangeForRange:

+ (NSRange) lineRangeForRange: (NSRange)aRange;

lossyCString

- (const char*) lossyCString;

lowercaseString

- (NSString*) lowercaseString;

pathComponents

- (NSArray*) pathComponents;

pathExtension

- (NSString*) pathExtension;

propertyList

- (id) propertyList;

propertyListFromStringsFileFormat

- (NSDictionary*) propertyListFromStringsFileFormat;

rangeOfCharacterFromSet:

- (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet;

rangeOfCharacterFromSet:options:

- (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet options: (unsigned int)mask;

rangeOfCharacterFromSet:options:range:

- (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet options: (unsigned int)mask range: (NSRange)aRange;

rangeOfComposedCharacterSequenceAtIndex:

- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (unsigned int)anIndex;

rangeOfString:

- (NSRange) rangeOfString: (NSString*)aString;
Invokes rangeOfString:options: with the options mask set to zero.

rangeOfString:options:

- (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.

rangeOfString:options:range:

- (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 -

smallestEncoding

- (NSStringEncoding) smallestEncoding;

stringByAbbreviatingWithTildeInPath

- (NSString*) stringByAbbreviatingWithTildeInPath;

stringByAppendingFormat:

- (NSString*) stringByAppendingFormat: (NSString*)format,;

stringByAppendingPathComponent:

- (NSString*) stringByAppendingPathComponent: (NSString*)aString;

stringByAppendingPathExtension:

- (NSString*) stringByAppendingPathExtension: (NSString*)string;

stringByAppendingString:

- (NSString*) stringByAppendingString: (NSString*)aString;

stringByDeletingLastPathComponent

- (NSString*) stringByDeletingLastPathComponent;

stringByDeletingPathExtension

- (NSString*) stringByDeletingPathExtension;

stringByExpandingTildeInPath

- (NSString*) stringByExpandingTildeInPath;

stringByReplacingString:withString:

- (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.

stringsByAppendingPaths:

- (NSArray*) stringsByAppendingPaths: (NSArray*)paths;

substringFromIndex:

- (NSString*) substringFromIndex: (unsigned int)anIndex;

substringToIndex:

- (NSString*) substringToIndex: (unsigned int)anIndex;

substringWithRange:

- (NSString*) substringWithRange: (NSRange)aRange;

uppercaseString

- (NSString*) uppercaseString;

writeToFile:atomically:

- (BOOL) writeToFile: (NSString*)path atomically: (BOOL)flag;