Up

NSString class reference

Authors

Andrew Kachites McCallum (mccallum@gnu.ai.mit.edu)

Version: 1.305

Date: 2003/11/10 15:34:51

Copyright: (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.


Contents -

  1. Software documentation for the NSMutableString class
  2. Software documentation for the NSString class
  3. Software documentation for the NXConstantString class
  4. Software documentation for the NSMutableString(GNUstep) category
  5. Software documentation for the NSMutableString(GSCategories) category
  6. Software documentation for the NSString(GSCategories) category

Software documentation for the NSMutableString class

NSMutableString : NSString

Declared in:
Foundation/NSString.h
Standards:

This is the mutable form of the NSString class.

Method summary

string

+ (id) string;

Description forthcoming.


stringWithCString:

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

Description forthcoming.


stringWithCString:length:

+ (id) stringWithCString: (const char*)byteString length: (unsigned int)length;

Description forthcoming.


stringWithCapacity:

+ (NSMutableString*) stringWithCapacity: (unsigned int)capacity;

Description forthcoming.


stringWithCharacters:length:

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

Description forthcoming.


stringWithContentsOfFile:

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

Description forthcoming.


stringWithFormat:,...

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

Description forthcoming.


appendFormat:,...

- (void) appendFormat: (NSString*)format,...;

Description forthcoming.


appendString:

- (void) appendString: (NSString*)aString;

Description forthcoming.


deleteCharactersInRange:

- (void) deleteCharactersInRange: (NSRange)range;

Description forthcoming.


initWithCapacity:

- (id) initWithCapacity: (unsigned int)capacity;

Description forthcoming.


insertString:atIndex:

- (void) insertString: (NSString*)aString atIndex: (unsigned int)loc;

Description forthcoming.


replaceCharactersInRange:withString:

- (void) replaceCharactersInRange: (NSRange)range withString: (NSString*)aString;

Description forthcoming.


replaceOccurrencesOfString:withString:options:range:

- (unsigned int) replaceOccurrencesOfString: (NSString*)replace withString: (NSString*)by options: (unsigned int)opts range: (NSRange)searchRange;

Replaces all occurrences of the replace string with the by string, for those cases where the entire replace string lies within the specified searchRange value.
The value of opts determines the direction of the search is and whether only leading/trailing occurrances (anchored search) of replace are substituted.
Raises NSInvalidArgumentException if either string argument is nil.
Raises NSRangeException if part of searchRange is beyond the end of the receiver.


setString:

- (void) setString: (NSString*)aString;

Description forthcoming.


Software documentation for the NSString class

NSString : NSObject

Declared in:
Foundation/NSString.h
Conforms to:
NSCoding
NSCopying
NSMutableCopying
Standards:

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.

To create a concrete subclass of NSString, you must have your class inherit from NSString and override at least the two primitive methods - length and characterAtIndex:

In general the rule is that your subclass must override any initialiser that you want to use with it. The GNUstep implementation relaxes that to say that, you may override only the designated initialiser and the other initialisation methods should work.

Method summary

availableStringEncodings

+ (NSStringEncoding*) availableStringEncodings;

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


constantStringClass

+ (Class) constantStringClass;

Return the class used to store constant strings (those ascii strings placed in the source code using the @"this is a string" syntax).
Use this method to obtain the constant string class rather than using the obsolete name NXConstantString in your code... with more recent compiler versions the name of this class is variable (and will automatically be changed by GNUstep to avoid conflicts with the default implementation in the Objective-C runtime library).


defaultCStringEncoding

+ (NSStringEncoding) defaultCStringEncoding;

Returns the encoding used for any method accepting a C string. This value is determined automatically from the programs environment and cannot be changed programmatically.

You should NOT override this method in an attempt to change the encoding being used... it won't work.

In GNUstep, this encoding is determined by the initial value of the GNUSTEP_STRING_ENCODING environment variable. If this is not defined, NSISOLatin1StringEncoding is assumed.


localizedNameOfStringEncoding:

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

Returns the localized name of the encoding specified.


localizedStringWithFormat:,...

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

Description forthcoming.


pathWithComponents:

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

Concatenates the strings in the components array placing a path separator between each one and returns the result.


string

+ (id) string;

Description forthcoming.


stringWithCString:

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

Description forthcoming.


stringWithCString:length:

+ (id) stringWithCString: (const char*)byteString length: (unsigned int)length;

Description forthcoming.


stringWithCharacters:length:

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

Description forthcoming.


stringWithContentsOfFile:

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

Description forthcoming.


stringWithContentsOfURL:

+ (id) stringWithContentsOfURL: (NSURL*)url;

Description forthcoming.


stringWithFormat:,...

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

Description forthcoming.


stringWithString:

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

Description forthcoming.


stringWithUTF8String:

+ (id) stringWithUTF8String: (const char*)bytes;

Description forthcoming.


UTF8String

- (const char*) UTF8String;

Description forthcoming.


_baseLength

- (int) _baseLength;

Warning the underscore at the start of the name of this method indicates that it is private, for internal use only, and you should not use the method in your code.


boolValue

- (BOOL) boolValue;

If the string consists of the words 'true' or 'yes' (case insensitive) or begins with a non-zero numeric value, return YES, otherwise return NO.


cString

- (const char*) cString;

Returns a pointer to a null terminated string of 8-bit characters in the default encoding. The memory pointed to is not owned by the caller, so the caller must copy its contents to keep it.


cStringLength

- (unsigned int) cStringLength;

Description forthcoming.


canBeConvertedToEncoding:

- (BOOL) canBeConvertedToEncoding: (NSStringEncoding)encoding;

Description forthcoming.


capitalizedString

- (NSString*) capitalizedString;

Description forthcoming.


caseInsensitiveCompare:

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

Description forthcoming.


characterAtIndex:

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

Description forthcoming.


commonPrefixWithString:options:

- (NSString*) commonPrefixWithString: (NSString*)aString options: (unsigned int)mask;

Description forthcoming.


compare:

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

Description forthcoming.


compare:options:

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

Description forthcoming.


compare:options:range:

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

Description forthcoming.


compare:options:range:locale:

- (NSComparisonResult) compare: (NSString*)string options: (unsigned int)mask range: (NSRange)compareRange locale: (NSDictionary*)dict;

Description forthcoming.


completePathIntoString:caseSensitive:matchesIntoArray:filterTypes:

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

Description forthcoming.


componentsSeparatedByString:

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

Description forthcoming.


dataUsingEncoding:

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

Description forthcoming.


dataUsingEncoding:allowLossyConversion:

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

Description forthcoming.


description

- (NSString*) description;

Description forthcoming.


doubleValue

- (double) doubleValue;

Returns the strings content as a double. Skips leading whitespace.
Conversion is not localised (ie uses '.' as the decimal separator).
Returns 0.0 on underflow or if the string does not contain a number.


fastestEncoding

- (NSStringEncoding) fastestEncoding;

Description forthcoming.


fileSystemRepresentation

- (const char*) fileSystemRepresentation;

Description forthcoming.


floatValue

- (float) floatValue;

Returns the strings content as a double. Skips leading whitespace.
Conversion is not localised (ie uses '.' as the decimal separator).
Returns 0.0 on underflow or if the string does not contain a number.


getCString:

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

Retrieve the contents of the receiver into the buffer.
The buffer must be large enought to contain the CString representation of the characters in the receiver, plus a null terminator which this method adds.


getCString:maxLength:

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

Retrieve up to maxLength characters from the receiver into the buffer.
The buffer must be at least maxLength characters long, so that it has room for the null terminator that this method adds.


getCString:maxLength:range:remainingRange:

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

Description forthcoming.


getCharacters:

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

Description forthcoming.


getCharacters:range:

- (void) getCharacters: (unichar*)buffer range: (NSRange)aRange;

Description forthcoming.


getFileSystemRepresentation:maxLength:

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

Description forthcoming.


getLineStart:end:contentsEnd:forRange:

- (void) getLineStart: (unsigned int*)startIndex end: (unsigned int*)lineEndIndex contentsEnd: (unsigned int*)contentsEndIndex forRange: (NSRange)aRange;

Determines the smallest range of lines containing aRange and returns the locations in that range.
Lines are delimited by any of these character sequences, the longest (CRLF) sequence preferred.

The index of the first character of the line at or before aRange is returned in startIndex.
The index of the first character of the next line after the line terminator is returned in endIndex.
The index of the last character before the line terminator is returned contentsEndIndex.
Raises an NSRangeException if the range is invalid, but permits the index arguments to be null pointers (in which case no value is returned in that argument).


hasPrefix:

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

Description forthcoming.


hasSuffix:

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

Description forthcoming.


hash

- (unsigned int) hash;

Return 28-bit hash value (in 32-bit integer). The top few bits are used for other purposes in a bitfield in the concrete string subclasses, so we must not use the full unsigned integer.


init

- (id) init;

Description forthcoming.


initWithCString:

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

Description forthcoming.


initWithCString:length:

- (id) initWithCString: (const char*)byteString length: (unsigned int)length;

Description forthcoming.


initWithCStringNoCopy:length:freeWhenDone:

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

Description forthcoming.


initWithCharacters:length:

- (id) initWithCharacters: (const unichar*)chars length: (unsigned int)length;

Description forthcoming.


initWithCharactersNoCopy:length:freeWhenDone:

- (id) initWithCharactersNoCopy: (unichar*)chars length: (unsigned int)length freeWhenDone: (BOOL)flag;
This is a designated initialiser for the class.

This is the most basic initialiser for unicode strings. In the GNUstep implementation, your subclasses may override this initialiser in order to have all others function.


initWithContentsOfFile:

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

Initialises the receiver with the contents of the file at path.

Invokes [NSData -initWithContentsOfFile:] to read the file, then examines the data to infer its encoding type, and converts the data to a string using -initWithData:encoding:

The encoding to use is determined as follows... if the data begins with the 16-bit unicode Byte Order Marker, then it is assumed to be unicode data in the appropriate ordering and converted as such.
If it begins with a UTF8 representation of the BOM, the UTF8 encoding is used.
Otherwise, the default C String encoding is used.

Releases the receiver and returns nil if the file could not be read and converted to a string.


initWithContentsOfURL:

- (id) initWithContentsOfURL: (NSURL*)url;

Description forthcoming.


initWithData:encoding:

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

Initialises the receiver with the supplied data, using the specified encoding.
For NSUnicodeStringEncoding and NSUTF8String encoding, a Byte Order Marker (if present at the start of the data) is removed automatically.
If the data can not be interpreted using the encoding, the receiver is released and nil is returned.


initWithFormat:,...

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

Invokes -initWithFormat:locale:arguments: with a nil locale.


initWithFormat:arguments:

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

Invokes -initWithFormat:locale:arguments: with a nil locale.


initWithFormat:locale:,...

- (id) initWithFormat: (NSString*)format locale: (NSDictionary*)locale,...;

Invokes -initWithFormat:locale:arguments:


initWithFormat:locale:arguments:

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

Initialises the string using the specified format and locale to format the following arguments.


initWithString:

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

Description forthcoming.


initWithUTF8String:

- (id) initWithUTF8String: (const char*)bytes;

Description forthcoming.


intValue

- (int) intValue;

Description forthcoming.


isAbsolutePath

- (BOOL) isAbsolutePath;

Description forthcoming.


isEqual:

- (BOOL) isEqual: (id)anObject;

Description forthcoming.


isEqualToString:

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

Description forthcoming.


lastPathComponent

- (NSString*) lastPathComponent;

Returns a string containing the last path component of the receiver.
The path component is the last non-empty substring delimited by the ends of the string or by path * separator ('/') characters.
If the receiver is an empty string, it is simply returned.
If there are no non-empty substrings, the root string is returned.


length

- (unsigned int) length;

Description forthcoming.


lineRangeForRange:

- (NSRange) lineRangeForRange: (NSRange)aRange;

Determines the smallest range of lines containing aRange and returns the information as a range.
Calls -getLineStart:end:contentsEnd:forRange: to do the work.


localizedCaseInsensitiveCompare:

- (NSComparisonResult) localizedCaseInsensitiveCompare: (NSString*)string;

Description forthcoming.


localizedCompare:

- (NSComparisonResult) localizedCompare: (NSString*)string;

Description forthcoming.


lossyCString

- (const char*) lossyCString;

Description forthcoming.


lowercaseString

- (NSString*) lowercaseString;

Returns a copy of the receiver with all characters converted to lowercase.


pathComponents

- (NSArray*) pathComponents;

Returns the path components of the reciever separated into an array.
If the receiver begins with a '/' character then that is used as the first element in the array.
Empty components are removed.


pathExtension

- (NSString*) pathExtension;

Returns a new string containing the path extension of the receiver.
The path extension is a suffix on the last path component which starts with the extension separator (a '.') (for example.tiff is the pathExtension for /foo/bar.tiff).
Returns an empty string if no such extension exists.


propertyList

- (id) propertyList;

Attempts to interpret the receiver as a property list and returns the result. If the receiver does not contain a string representation of a property list then the method returns nil.

There are three readable property list storage formats - The binary format used by NSSerializer does not concern us here, but there are two 'human readable' formats, the traditional OpenStep format (which is extended in GNUstep) and the XML format.

The [NSArray -descriptionWithLocale:indent:] and [NSDictionary -descriptionWithLocale:indent:] methods both generate strings containing traditional style property lists, but [NSArray -writeToFile:atomically:] and [NSDictionary -writeToFile:atomically:] generate either traditional or XML style property lists depending on the value of the GSMacOSXCompatible and NSWriteOldStylePropertyLists user defaults.
If GSMacOSXCompatible is YES then XML property lists are written unless NSWriteOldStylePropertyLists is also YES.
By default GNUstep writes old style data and always supports reading of either style.

The traditional format is more compact and more easily readable by people, but (without the GNUstep extensions) cannot represent date and number objects (except as strings). The XML format is more verbose and less readable, but can be fed into modern XML tools and thus used to pass data to non-OpenStep applications more readily.

The traditional format is strictly ascii encoded, with any unicode characters represented by escape sequences. The XML format is encoded as UTF8 data.

Both the traditional format and the XML format permit comments to be placed in property list documents. In traditional format the comment notations used in ObjectiveC programming are supported, while in XML format, the standard SGML comment sequences are used.

A property list may only be one of the following classes -

NSArray
An array which is either empty or contains only property list objects.
An array is delimited by round brackets and its contents are comma separated (there is no comma after the last array element).
       ( "one", "two", "three" )
     
In XML format, an array is an element whose name is array and whose content is the array content.
       <array><string>one</string><string>two</string><string>three</string></array>
     
NSData
An array is represented as a series of pairs of hexadecimal characters (each pair representing a byte of data) enclosed in angle brackets. Spaces are ignored).
       < 54637374 696D67 >
     
In XML format, a data object is an element whose name is data and whose content is a stream of base64 encoded bytes.
NSDate
Date objects were not traditionally allowed in property lists but were added when the XML format was intoroduced. GNUstep provides an extension to the traditional property list format to support date objects, but older code will not read property lists containing this extension.
This format consists of an asterisk follwed by the letter 'D' then a date/time in YYYY-MM-DD HH:MM:SS +/-ZZZZ format, all enclosed within angle brackets.
       <*D2002-03-22 11:30:00 +0100>
     
In XML format, a date object is an element whose name is date and whose content is a date in the above format.
       <date>2002-03-22 11:30:00 +0100</date>
     
NSDictionary
A dictionary which is either empty or contains only string keys and property list objects.
A dictionary is delimited by curly brackets and its contents are semicolon terminated (there is a semicolon after each value). Each item in the dictionary is a key/value pair with an equals sign after the key and before the value.
       {
         "key1" = "value1";
       }
     
In XML format, a dictionary is an element whose name is dictionary and whose content consists of pairs of strings and other property list objects.
       <dictionary>
         <string>key1</string>
         <string>value1</string>
       </dictionary>
     
NSNumber
Number objects were not traditionally allowed in property lists but were added when the XML format was intoroduced. GNUstep provides an extension to the traditional property list format to support number objects, but older code will not read property lists containing this extension.
Numbers are stored in a variety of formats depending on their values.
NSString
A string is either stored literally (if it contains no spaces or special characters), or is stored as a quoted string with special characters escaped where necessary.
Escape conventions are similar to those normally used in ObjectiveC programming, using a backslash followed by -
       "hello world & others"
     
In XML format, the string is simply stored in UTF8 format as the content of a string element, and the only character escapes required are those used by XML such as the '&lt;' markup representing a '<' character.
       <string>hello world &amp; others</string>"
     


propertyListFromStringsFileFormat

- (NSDictionary*) propertyListFromStringsFileFormat;

Reads a property list (see -propertyList) from a simplified file format. This format is a traditional style property list file containing a single dictionary, but with the leading '{' and trailing '}' characters omitted.

That is to say, the file contains only semicolon separated key/value pairs (and optionally comments). As a convenience, it is possible to omit the equals sign and the value, so an entry consists of a key string followed by a semicolon. In this case, the value for that key is assumed to be an empty string.

  
   // Strings file entries follow -
   key1 = " a string value";
   key2;	// This key has an empty string as a value.
   "Another key" = "a longer string value for th third key";
 


rangeOfCharacterFromSet:

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

Description forthcoming.


rangeOfCharacterFromSet:options:

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

Description forthcoming.


rangeOfCharacterFromSet:options:range:

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

Description forthcoming.


rangeOfComposedCharacterSequenceAtIndex:

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

Description forthcoming.


rangeOfString:

- (NSRange) rangeOfString: (NSString*)string;

Invokes -rangeOfString:options: with the options mask set to zero.


rangeOfString:options:

- (NSRange) rangeOfString: (NSString*)string 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*)aString options: (unsigned int)mask range: (NSRange)aRange;

Returns the range giving the location and length of the first occurrence of aString within aRange.
If aString 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 aString is nil, an exception is raised.
If any part of aRange lies outside the range of the receiver, an exception is raised.
The options mask may contain the following options -


smallestEncoding

- (NSStringEncoding) smallestEncoding;

Description forthcoming.


stringByAbbreviatingWithTildeInPath

- (NSString*) stringByAbbreviatingWithTildeInPath;

Returns a string where a prefix of the current user's home directory is abbreviated by '~', or returns the receiver if it was not found to have the home directory as a prefix.


stringByAppendingFormat:,...

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

Description forthcoming.


stringByAppendingPathComponent:

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

Returns a new string with the path component given in aString appended to the receiver. Removes trailing separators and multiple separators.


stringByAppendingPathExtension:

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

Returns a new string with the path extension given in aString appended to the receiver after the extensionSeparator ('.').
If the receiver has trailing '/' characters which are not part of the root directory, those '/' characters are stripped before the extension separator is added.


stringByAppendingString:

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

Description forthcoming.


stringByDeletingLastPathComponent

- (NSString*) stringByDeletingLastPathComponent;

Returns a new string with the last path component (including any final path separators) removed from the receiver.
A string without a path component other than the root is returned without alteration.
See -lastPathComponent for a definition of a path component.


stringByDeletingPathExtension

- (NSString*) stringByDeletingPathExtension;

Returns a new string with the path extension removed from the receiver.
Strips any trailing path separators before checking for the extension separator.
Does not consider a string starting with the extension separator ('.') to be a path extension.


stringByExpandingTildeInPath

- (NSString*) stringByExpandingTildeInPath;

Returns a string created by expanding the initial tilde ('~') and any following username to be the home directory of the current user or the named user.
Returns the receiver if it was not possible to expand it.


stringByPaddingToLength:withString:startingAtIndex:

- (NSString*) stringByPaddingToLength: (unsigned int)newLength withString: (NSString*)padString startingAtIndex: (unsigned int)padIndex;

Returns a string formed by extending or truncating the receiver to newLength characters. If the new string is larger, it is padded by appending characters from padString (appending it as many times as required). The first character from padString to be appended is specified by padIndex.


stringByResolvingSymlinksInPath

- (NSString*) stringByResolvingSymlinksInPath;

Description forthcoming.


stringByStandardizingPath

- (NSString*) stringByStandardizingPath;

Returns a standardised form of the receiver, with unnecessary parts removed, tilde characters expanded, and symbolic links resolved where possible.
If the string is an invalid path, the unmodified receiver is returned.

Uses -stringByExpandingTildeInPath to expand tilde expressions.
Simplifies '//' and '/./' sequences.
Removes any '/private' prefix.

For absolute paths, uses -stringByResolvingSymlinksInPath to resolve any links, then gets rid of '/../' sequences.


stringByTrimmingCharactersInSet:

- (NSString*) stringByTrimmingCharactersInSet: (NSCharacterSet*)aSet;

Return a string formed by removing characters from the ends of the receiver. Characters are removed only if they are in aSet.
If the string consists entirely of characters in aSet , an empty string is returned.
The aSet argument nust not be nil.


stringsByAppendingPaths:

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

Returns an array of strings made by appending the values in paths to the receiver.


substringFromIndex:

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

Returns a substring of the receiver from character at the specified index to the end of the string.
So, supplying an index of 3 would return a substring consisting of the entire string apart from the first three character (those would be at index 0, 1, and 2).
If the supplied index is greater than or equal to the length of the receiver an exception is raised.


substringFromRange:

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

An obsolete name for -substringWithRange: ... deprecated.


substringToIndex:

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

Returns a substring of the receiver from the start of the string to (but not including) the specified index position.
So, supplying an index of 3 would return a substring consisting of the first three characters of the receiver.
If the supplied index is greater than the length of the receiver an exception is raised.


substringWithRange:

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

Returns a substring of the receiver containing the characters in aRange.
If aRange specifies any character position not present in the receiver, an exception is raised.
If aRange has a length of zero, an empty string is returned.


uppercaseString

- (NSString*) uppercaseString;

Returns a copy of the receiver with all characters converted to uppercase.


writeToFile:atomically:

- (BOOL) writeToFile: (NSString*)filename atomically: (BOOL)useAuxiliaryFile;

Description forthcoming.


writeToURL:atomically:

- (BOOL) writeToURL: (NSURL*)anURL atomically: (BOOL)atomically;

Description forthcoming.


Software documentation for the NXConstantString class

NXConstantString : NSString

Declared in:
Foundation/NSString.h
Standards:

The NXConstantString class is used to hold constant 8-bit character string objects produced by the compiler where it sees @"..." in the source. The compiler generates the instances of this class - which has three instance variables -

In older versions of the compiler, the isa variable is always set to the NXConstantString class. In newer versions a compiler option was added for GNUstep, to permit the isa variable to be set to another class, and GNUstep uses this to avoid conflicts with the default implementation of NXConstantString in the ObjC runtime library (the preprocessor is used to change all occurances of NXConstantString in the source code to NSConstantString).

Since GNUstep will generally use the GNUstep extension to the compiler, you should never refer to the constnat string class by name, but should use the [NSString +constantStringClass] method to get the actual class being used for constant strings.

What follows is a dummy declaration of the class to keep the compiler happy.

Software documentation for the NSMutableString(GNUstep) category

NSMutableString(GNUstep)

Declared in:
Foundation/NSString.h
Standards:

GNUstep specific (non-standard) additions to the NSMutableString class. The methods in this category are not available in MacOS-X

Method summary

immutableProxy

- (NSString*) immutableProxy;

Returns a proxy to the receiver which will allow access to the receiver as an NSString, but which will not allow any of the extra NSMutableString methods to be used. You can use this method to provide other code with read-only access to a mutable string you own.


Software documentation for the NSMutableString(GSCategories) category

NSMutableString(GSCategories)

Declared in:
Foundation/NSString.h
Standards:

Description forthcoming.

Method summary

deletePrefix:

- (void) deletePrefix: (NSString*)prefix;

Description forthcoming.


deleteSuffix:

- (void) deleteSuffix: (NSString*)suffix;

Description forthcoming.


replaceString:withString:

- (void) replaceString: (NSString*)replace withString: (NSString*)by;

Description forthcoming.


trimLeadSpaces

- (void) trimLeadSpaces;

Description forthcoming.


trimSpaces

- (void) trimSpaces;

Description forthcoming.


trimTailSpaces

- (void) trimTailSpaces;

Description forthcoming.


Software documentation for the NSString(GSCategories) category

NSString(GSCategories)

Declared in:
Foundation/NSString.h
Standards:

Description forthcoming.

Method summary

stringWithFormat:arguments:

+ (id) stringWithFormat: (NSString*)format arguments: (va_list)argList;

Description forthcoming.


stringByDeletingPrefix:

- (NSString*) stringByDeletingPrefix: (NSString*)prefix;

Description forthcoming.


stringByDeletingSuffix:

- (NSString*) stringByDeletingSuffix: (NSString*)suffix;

Description forthcoming.


stringByReplacingString:withString:

- (NSString*) stringByReplacingString: (NSString*)replace withString: (NSString*)by;

Description forthcoming.


stringByTrimmingLeadSpaces

- (NSString*) stringByTrimmingLeadSpaces;

Description forthcoming.


stringByTrimmingSpaces

- (NSString*) stringByTrimmingSpaces;

Description forthcoming.


stringByTrimmingTailSpaces

- (NSString*) stringByTrimmingTailSpaces;

Description forthcoming.



Up