This is NSString.rtf in view mode; [Download] [Up]
paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc. All Rights Reserved. s4 li100 fi0 ri1007 ql f0 b fs36 fs100 fs36 NSString pard s11 li2872 fi-2771 ri1007 ql tx2872 f1 b0 fs28 fs48 fs28 f0 b fs24 Inherits From:tab b0 fs28 f1 NSObject fs20 fs28 s6 f0 b fs24 Conforms To:tab b0 fs28 f1 NSCoding, NSCopying, NSMutableCopying fi0 NSObject (NSObject) fs20 fs28 s7 fi-2771 f0 b fs24 Declared In:tab b0 fs28 f1 Foundation/NSString.h fi0 Foundation/NSPathUtilities.h fi0 Foundation/NSUtilities.h fs20 fs28 pard s16 li100 fi0 ri1007 ql f0 b fs28 fs20 fs28 Class Description fs14 fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 fs28 NSString declares the programmatic interface for objects that create and manage immutable character strings in a i representation-independenti0 format. fs16 fs28 NSString (and NSMutableString) are abstract classes for string manipulation. NSString provides methods for read-only access, while NSMutableString allows for changing the contents of the string. NSString and NSMutableString provide factory methods that return autoreleased instances of unspecified subclasses of strings. fs16 fs28 While the actual representation of character strings stored in NSString and NSMutableString is independent of any particular implementation, you can in general think of the contents of NSString and NSMutableString objects as being, canonically, b Unicodeb0 characters (defined by the b unicharb0 data type). Methods that use the terms 'aacharacter'ba, 'aarange'ba, and 'aalength'ba, refer to strings of b unicharb0 s and ranges and lengths of b unicharb0 strings'd0this is important, because conversion between b unicharb0 s and other character encodings is not necessarily one-to-one. For instance, an ISO Latin1 encoded string of a given length might contain fewer or more characters when encoded as b unicharb0 s. Another important point is that b unicharb0 s don't necessarily correspond one-to-one with what is normally thought of as 'aaletters'ba in a string; if you need to go through a string in terms of 'baletters'ba, use b rangeOfComposedCharacterSequenceAtIndex:b0 . fs16 fs28 Methods that take 'aaCString'ba arguments deal with the default eight-bit encoding of the environment, which could be, for instance, EUC or ISOLatin1. You can also explicitly convert to and from any encoding by using methods such as b initWithData:usingEncoding:b0 and b dataUsingEncoding:b0 . fs16 fs28 Constant NSStrings can be created with the @"..." option'd0such strings should contain only ASCII characters, and nothing more. fs16 fs28 Strings are provided with generic coding behavior when used for storage or distribution. This behavior is to copy the contents and provide a generic NSString implementation, losing class but preserving mutability. fs16 fs28 In general, you instantiate NSString objects sending one of the b stringWithb0 'bc methods or the b localizedStringWithFormat:b0 method to the NSString class object. For NSString objects that were allocated 'aamanually'ba, use any of the b initWithb0 'bc methods to initialize the contents of the string object. fs16 fs28 The primitive methods to NSString are b lengthb0 and b characterAtIndex:b0 . fs16 fs28 UNIX-style file system path names can be manipulated using the collection of b stringByb0 'bc methods described under 'aaManipulating File System Paths'ba below. fs16 fs28 fs16 fs28 pard s16 li100 fi0 ri1007 ql f0 b fs24 fs28 Creating Temporary Strings fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 + (NSString *)b localizedStringWithFormat:b0 (NSString *)i format,... s9 li7030 fi-6553 fi-5796 i0 tab Returns a string created by using i formati0 as a b printf()b0 style format string, and the following arguments as values to be substituted into the format string. The user'27s default locale is used for format information. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (NSString *)b stringWithCString:b0 (const char *)i byteString s9 li7030 fi-6553 fi-5796 i0 tab Returns a string containing the characters in i byteStringi0 , which must be null-terminated. i byteStringi0 should contain characters in the default C string encoding. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (NSString *)b stringWithCString:b0 (const char *)i byteStringi0 tab s9 li7030 fi-6553 fi-5796 b length:b0 (unsigned int)i lengthi0 tab Returns a string containing characters from i byteStringi0 . i byteStringi0 should contain characters in the default C string encoding. i lengthi0 bytes are copied into the string, regardless of whether a null byte exists in i byteStringi0 . Raises NSInvalidArgumentException if i byteStringi0 is NULL s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (NSString *)b stringWithCharacters:b0 (const unichar *)i chai0 rs s9 li7030 fi-6553 fi-5796 b length:b0 (unsigned int)i lengthi0 tab Returns a string containing i charsi0 . i lengthi0 characters are copied into the string, regardless of whether a null character exists in i charsi0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (NSString *)b stringWithContentsOfFile:b0 (NSString *)i path s9 li7030 fi-6553 fi-5796 i0 tab Returns a string containing the contents of the file specified by i pathi0 . This method attempts to determine the encoding for the file. The string is assumed to be in Unicode encoding, but if the encoding is determined not to be Unicode, the default C string encoding is used instead. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (NSString *)b stringWithFormat:b0 (NSString *)i format,... s9 li7030 fi-6553 fi-5796 i0 tab Returns a string created by using i formati0 as a b printf()b0 style format string, and the following arguments as values to be substituted into the format string. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Initializing Newly Allocated Strings fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (id)b initb0 tab Initializes the receiver, a newly allocated NSString, to contain no characters. This is the only initialization method that a subclass of NSString should invoke. fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithCString:b0 (const char *)i byteStringi0 tab Initializes the receiver, a newly allocated NSString, by converting the one-byte characters in i byteStringi0 into Unicode characters. i byteStringi0 must be a null-terminated C string in the default C string encoding. fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithCString:b0 (const char *)i byteStringi0 tab Initializes the receiver, a newly allocated NSString, by s9 li7030 fi-6553 fi-5796 b length:b0 (unsigned int)i lengthi0 tab tab converting i lengthi0 one-byte characters in i byteStringi0 into Unicode characters. This method doesn'27t stop at a null byte. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithCStringNoCopy:b0 (char *)i byteStringi0 tab Initializes the receiver, a newly allocated NSString, by s9 li7030 fi-6553 fi-5796 b length:b0 (unsigned int)i lengthi0 tab tab converting i lengthi0 one-byte characters in i byteStringi0 into b freeWhenDone:b0 (BOOL)i flagi0 tab tab Unicode characters. This method doesn'27t stop at a null byte. The receiver becomes the owner of i byteString;i0 if i flagi0 is YES it will free the memory when it no longer needs it, but if i flagi0 is NO it won'27t. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithCharacters:b0 (const unichar *)i charsi0 tab Initializes the receiver, a newly allocated NSString, by s9 li7030 fi-6553 fi-5796 b length:b0 (unsigned int)i lengthi0 tab tab copying i lengthi0 characters from i charsi0 . This method doesn'27t stop at a null character. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithCharactersNoCopy:b0 (unichar *)i charsi0 tab Initializes the receiver, a newly allocated NSString, to s9 li7030 fi-6553 fi-5796 b length:b0 (unsigned int)i lengthi0 tab tab contain i lengthi0 characters from i charsi0 . This method b freeWhenDone:b0 (BOOL)i flagi0 tab tab doesn'27t stop at a null character. The receiver becomes the owner of i chars;i0 if i flagi0 is YES the receiver will free the memory when it no longer needs them, but if i flagi0 is NO it won'27t. Note that the NO case could be dangerous if used with memory that could be freed. The NO flag should be used only when the provided backing store is permanent. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithContentsOfFile:b0 (NSString *)i pathi0 tab Initializes the receiver, a newly allocated NSString, by reading characters from the file whose name is given by i pathi0 . This method attempts to determine the encoding for the file. The string is assumed to be in Unicode encoding, but if the encoding is determined not to be Unicode, the default C string encoding is used instead. Also see b writeToFile:atomically:b0 in 'aaStoring the String'ba. fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithData:b0 (NSData *)i datai0 tab Initializes the receiver, a newly allocated NSString, by s9 li7030 fi-6553 fi-5796 b encoding:b0 (NSStringEncoding)i encodingi0 tab tab converting the bytes in i datai0 into Unicode characters. i datai0 must be an NSData object containing bytes in i encodingi0 and in the default 'aaplain text'ba format for that encoding. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithFormat:b0 (NSString *)i format,...i0 tab Initializes the receiver, a newly allocated NSString, by constructing a string from i formati0 and following string objects in the manner of b printf()b0 . fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithFormat:b0 (NSString *)i formati0 tab Initializes the receiver, a newly allocated NSString, by s9 li7030 fi-6553 fi-5796 b arguments:b0 (va_list)i argListi0 tab tab constructing a string from i formati0 and i argListi0 in the manner of b vprintf()b0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithFormat:b0 (NSString *)i formati0 tab Initializes the receiver, a newly allocated NSString, by s9 li7030 fi-6553 fi-5796 b locale:b0 (NSDictionary *)i dictionaryi0 ,...tab tab constructing a string from i formati0 and the formatting information in the dictionary in the manner of b printf()b0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithFormat:b0 (NSString *)i formati0 tab Initializes the receiver, a newly allocated NSString, by s9 li7030 fi-6553 fi-5796 b locale:b0 (NSDictionary *)i dictionaryi0 tab tab constructing a string from i formati0 and format b arguments:b0 (va_list)i argListi0 tab tab information in i dictionaryi0 and i argListi0 in the manner of b vprintf()b0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithString:b0 (NSString *)i stringi0 tab Initializes the receiver, a newly allocated NSString, by copying the characters from i stringi0 . pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Getting a String'27s Length fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (unsigned int)b lengthb0 tab Returns the number of characters in the receiver. This number includes the individual characters of composed character sequences. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Accessing Characters fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (unichar)b characterAtIndex:b0 (unsigned int)i indexi0 tab Returns the character at the array position given by i indexi0 . This method raises an b NSStringBoundsErrorb0 exception if i indexi0 lies beyond the end of the string. fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b getCharacters:b0 (unichar *)i bufferi0 tab Invokes b getCharacters:range:b0 with the provided i bufferi0 and the entire extent of the receiver as the range. fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b getCharacters:b0 (unichar *)i bufferi0 tab Copies characters from i aRangei0 in the receiver into i bufferi0 , s9 li7030 fi-6553 fi-5796 b range:b0 (NSRange)i aRangei0 tab tab which must be large enough to contain them. This method does i noti0 add a null character. This method raises an b NSStringBoundsErrorb0 exception if any part of i aRangei0 lies beyond the end of the string. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Combining Strings fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSString *)b stringByAppendingFormat:b0 (NSString *)i format,... s9 li7030 fi-6553 fi-5796 i0 tab Returns a string made by using i formati0 as a b printf()b0 style format string, and the following arguments as values to be substituted into the format string. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b stringByAppendingString:b0 (NSString *)i aString s9 li7030 fi-6553 fi-5796 i0 tab Returns a string made by appending i aStringi0 and the receiver. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Dividing Strings into Substrings fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSArray *)b componentsSeparatedByString:b0 (NSString *)i separator s9 li7030 fi-6553 fi-5796 i0 tab Finds the substrings in the receiver that are delimited by i separatori0 and returns them as the elements of an NSArray. The strings in the array appear in the order they did in the receiver. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b substringFromIndex:b0 (unsigned int)i index s9 li7030 fi-6553 fi-5796 i0 tab Returns a string object containing the characters of the receiver starting from the one at i indexi0 to the end. This method raises an b NSStringBoundsErrorb0 exception if i indexi0 lies beyond the end of the string. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b substringFromRange:b0 (NSRange)i aRange s9 li7030 fi-6553 fi-5796 i0 tab Returns a string object containing the characters of the receiver which lie within i aRangei0 . This method raises an b NSStringBoundsErrorb0 exception if any part of i aRangei0 lies beyond the end of the string. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b substringToIndex:b0 (unsigned int)i index s9 li7030 fi-6553 fi-5796 i0 tab Returns a string object containing the characters of the receiver up to, but not including, the one at i indexi0 . This method raises an b NSStringBoundsErrorb0 exception if i indexi0 lies beyond the end of the string. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Finding Ranges of Characters and Substrings fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSRange)b rangeOfCharacterFromSet:b0 (NSCharacterSet *)i aSet s9 li7030 fi-6553 fi-5796 i0 tab Invokes b rangeOfCharacterFromSet:options:b0 with no options. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSRange)b rangeOfCharacterFromSet:b0 (NSCharacterSet *)i aSet s9 li7030 fi-6553 fi-5796 i0 b options:b0 (unsigned int)i maski0 tab Invokes b rangeOfCharacterFromSet:options:range:b0 with i maski0 and the entire extent of the receiver as the range. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSRange)b rangeOfCharacterFromSet:b0 (NSCharacterSet *)i aSet s9 li7030 fi-6553 fi-5796 i0 b options:b0 (unsigned int)i maski0 tab Returns the range of the first character found from i aSeti0 . b range:b0 (NSRange)i aRangei0 tab tab The search is restricted to i aRangei0 with i maski0 options. i maski0 can be any combination (using the C bitwise OR operator |) of NSCaseInsensitiveSearch, NSLiteralSearch, and NSBackwardsSearch. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSRange)b rangeOfString:b0 (NSString *)i stringi0 tab Invokes b rangeOfString:options:b0 with no options. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSRange)b rangeOfString:b0 (NSString *)i stringi0 tab Invokes b rangeOfString:options:range:b0 with i mask s9 li7030 fi-6553 fi-5796 i0 b options:b0 (unsigned int)i maski0 tab tab options and the entire extent of the receiver as the range. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSRange)b rangeOfString:b0 (NSString *)i aStringi0 tab Returns the range giving the location and length in the s9 li7030 fi-6553 fi-5796 b options:b0 (unsigned int)i maski0 tab tab receiver of i aStringi0 . The search is restricted to i aRange i0 b range:b0 (NSRange)i aRangei0 tab tab with i maski0 options. i maski0 can be any combination (using the C bitwise OR operator |) of NSCaseInsensitiveSearch, NSLiteralSearch, NSBackwardsSearch, and NSAnchoredSearch. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Determining Composed Character Sequences fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSRange)b rangeOfComposedCharacterSequenceAtIndex:b0 (unsigned int)i anIndex s9 li7030 fi-6553 fi-5796 i0 tab Returns an NSRange giving the location and length in the receiver of the composed character sequence located at i anIndexi0 . This method raises an b NSStringBoundsErrorb0 exception if i anIndexi0 lies beyond the end of the string. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Identifying and Comparing Strings fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSComparisonResult)b caseInsensitiveCompare:b0 (NSString *)i aStringi0 tab s9 li7030 fi-6553 fi-5796 tab Invokes b compare:options:b0 with the option NSCaseInsensitiveSearch. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSComparisonResult)b compare:b0 (NSString *)i aStringi0 tab s9 li7030 fi-6553 fi-5796 tab Invokes b compare:options:b0 with no options. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSComparisonResult)b compare:b0 (NSString *)i aStringi0 tab s9 li7030 fi-6553 fi-5796 b options:b0 (unsigned int)i maski0 tab Invokes b compare:options:range:b0 with i maski0 as the options and the receiver'27s full extent as the range. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSComparisonResult)b compare:b0 (NSString *)i aString s9 li7030 fi-6553 fi-5796 i0 b options:b0 (unsigned int)i maski0 tab Compares i aStringi0 to the receiver and returns their lexical b range:b0 (NSRange)i aRangei0 tab tab ordering. The comparison is restricted to i aRangei0 and uses i maski0 options, which may be NSCaseInsensitiveSearch and NSLiteralSearch. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b hasPrefix:b0 (NSString *)i aStringi0 tab Returns YES if i aStringi0 matches the beginning characters of the receiver, NO otherwise. fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b hasSuffix:b0 (NSString *)i aStringi0 tab Returns YES if i aStringi0 matches the ending characters of the receiver, NO otherwise. fi-6552 fs16 fs28 fi-6552 {f3 -} (unsigned int)b hashb0 tab Returns an unsigned integer that can be used as a table address in a hash table structure. If two string objects are equal (as determined by the b isEqual:b0 method), they must have the same hash valueb . fi-6552 b0 fs16 fs28 fi-6552 {f3 -} (BOOL)b isEqual:b0 (id)i anObjecti0 tab Returns YES if both the receiver and i anObjecti0 have the same b idb0 or if they'27re both NSStrings that compare as b NSOrderedSameb0 , NO otherwise. fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b isEqualToString:b0 (NSString *)i aStringi0 tab Returns YES if i aStringi0 is equivalent to the receiver (if they have the same b idb0 or if they compare as b NSOrderedSameb0 ), NO otherwise. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Storing the String fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSString *)b descriptionb0 tab Returns the string itself. fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b writeToFile:b0 (NSString *)i filenamei0 tab Writes a textual description of the receiver to i filename. s9 li7030 fi-6553 fi-5796 i0 b atomically:b0 (BOOL)i useAuxiliaryFilei0 tab tab Ifi useAuxiliaryFilei0 is YES, the data is written to a backup file and then, assuming no errors occur, the backup file is renamed to the intended file name. The string is written in the default C string encoding if the contents can be converted to that encoding. If not, the string is stored in the Unicode encoding. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Getting a Shared Prefix fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSString *)b commonPrefixWithString:b0 (NSString *)i aString s9 li7030 fi-6553 fi-5796 i0 b options:b0 (unsigned int)i maski0 tab Returns the substring of the receiver containing characters that the receiver and i aStringi0 have in common. i maski0 can be any combination (using the C bitwise OR operator |) of NSCaseInsensitiveSearch and NSLiteralSearch. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Changing Case fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSString *)b capitalizedStringb0 tab Returns a string with the first character of each word changed to its corresponding uppercase value. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b lowercaseStringb0 tab Returns a string with each character changed to its corresponding lowercase value. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b uppercaseStringb0 tab Returns a string with each character changed to its corresponding uppercase value. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Getting C Strings fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (const char *)b cStringb0 tab Returns a representation of the receiver as a C string in the default C string encoding. fi-6552 fs16 fs28 fi-6552 {f3 -} (unsigned int)b cStringLengthb0 tab Returns the length in bytes of the C string representation of the receiver. fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b getCString:b0 (char *)i bufferi0 tab Invokes b getCString:maxLength:range:remainingRange:b0 with NSMaximumStringLength as the maximum length, the receiver'27s entire extent as the range, and NULL for the remaining range. i bufferi0 must be large enough to contain the resulting C string plus a terminating null character (which this method adds). fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b getCString:b0 (char *)i bufferi0 tab Invokes s9 li7030 fi-6553 fi-5796 b maxLength:b0 (unsigned int)i maxLengthi0 tab b tab getCString:maxLength:range:remainingRange:b0 with i maxLengthi0 as the maximum length, the receiver'27s entire extent as the range, and NULL for the remaining range. i bufferi0 must be large enough to contain the resulting C string plus a terminating null character (which this method adds). s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (void)b getCString:b0 (char *)i bufferi0 tab Copies the receiver'27s characters (in the default C string s9 li7030 fi-6553 fi-5796 b maxLength:b0 (unsigned int)i maxLengthi0 tab tab encoding) as bytes into i bufferi0 . i bufferi0 must be b range:b0 (NSRange)i aRangei0 tab tab large enough to contain i maxLengthi0 bytes plus a b remainingRange:b0 (NSRange *)i leftoverRangei0 tab tab terminating null character (which this method adds). Characters are copied from i aRangei0 ; if not all characters can be copied, the range of those not copied is put into i leftoverRangei0 .i i0 This method raises an b NSStringBoundsErrorb0 exception if any part of i aRangei0 lies beyond the end of the string. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Getting Numeric Values fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (double)b doubleValueb0 tab Returns the double precision floating point value of the receiver'27s text. Whitespace at the beginning of the string is skipped. If the receiver begins with a valid text representation of a floating-point number, that number'27s value is returned, otherwise 0.0 is returned. HUGE_VAL or {f3 -}HUGE_VAL is returned on overflow. 0.0 is returned on underflow. Characters following the number are ignored. fi-6552 fs16 fs28 fi-6552 {f3 -} (float)b floatValueb0 tab Returns the floating-point value of the receiver'27s text. Whitespace at the beginning of the string is skipped. If the receiver begins with a valid text representation of a floating-point number, that number'27s value is returned, otherwise 0.0 is returned. HUGE_VAL or {f3 -}HUGE_VAL is returned on overflow. 0.0 is returned on underflow. Characters following the number are ignored. fi-6552 fs16 fs28 fi-6552 {f3 -} (int)b intValueb0 tab Returns the integer value of the receiver'27s text. Whitespace at the beginning of the string is skipped. If the receiver begins with a valid representation of an integer, that number'27s value is returned, otherwise 0 is returned. INT_MAX or INT_MIN is returned on overflow. Characters following the number are ignored. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Working With Encodings fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 + (NSStringEncoding *)b availableStringEncodingsb0 tab Returns a null terminated array of available string encodings.. fi-6552 fs16 fs28 fi-6552 + (NSStringEncoding)b defaultCStringEncodingb0 tab Returns the C string encoding assumed for any method accepting a C string as an argument. fi-6552 fs16 fs28 fi-6552 +(NSString *)b localizedNameOfStringEncoding:b0 (NSStringEncoding)i encoding s9 li7030 fi-6553 fi-5796 i0 tab Returns the localized name of the string encoding specified by i encodingi0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b canBeConvertedToEncoding:b0 (NSStringEncoding)i encoding s9 li7030 fi-6553 fi-5796 i0 tab Returns YES if the receiver can be converted to i encodingi0 without loss of information, and NO otherwise. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSData *)b dataUsingEncoding:b0 (NSStringEncoding)i encoding s9 li7030 fi-6553 fi-5796 i0 tab Invokes b dataUsingEncoding:allowLossyConversion:b0 with NO as the argument to allow lossy conversion. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSData *)b dataUsingEncoding:b0 (NSStringEncoding)i encoding s9 li7030 fi-6553 fi-5796 i0 b allowLossyConversion:b0 (BOOL)i flagi0 tab Returns an NSData object containing a representation of the receiver in i encodingi0 . If i flagi0 is NO and the receiver can'27t be converted without losing some information (such as accents or case) this method returns b nilb0 . If i flagi0 is YES and the receiver can'27t be converted without losing some information, some characters may be removed or altered in conversion. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSStringEncoding)b fastestEncodingb0 tab Encoding in which this string can be expressed (with lossless conversion) most quickly. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSStringEncoding)b smallestEncodingb0 tab Encoding in which this string can be expressed (with lossless conversion) in the most space efficient manner pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Converting String Contents into a Property List fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (id)b propertyListb0 tab Depending on the format of the receiver'27s contents, returns a string, data, array, or dictionary object represention of those contents. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSDictionary *)b propertyListFromStringsFileFormat s9 li7030 fi-6553 fi-5796 b0 tab Returns a dictionary object initialized with the keys and values found in the receiver. The receiver'27s format must be that used for 'aa.string'ba files. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Manipulating File System Paths fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (unsigned int)b completePathIntoString:b0 (NSString **)i outputName s9 li7030 fi-6553 fi-5796 i0 b caseSensitive:b0 (BOOL)i flagi0 tab Regards the receiver as containing a partial filename and b matchesIntoArray:b0 (NSArray **)i outputArrayi0 tab tab returns in i outputNamei0 the longest matching path name. b filterTypes:b0 (NSArray *)i filterTypesi0 tab tab Case is considered if i flagi0 is YES. If i outputArrayi0 is given, all matching filenames are return in i outputArrayi0 . If i filterTypesi0 is provided, this method considers only those paths that match one of the types. Returns 0 if no matches are found; otherwise, the return value is positive. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b lastPathComponentb0 tab Returns the last component of the receiver'27s path representation. Given the path 'aa/Images/Bloggs.tiff'ba, this method returns a string containing 'aaBloggs.tiff'ba. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b pathExtensionb0 tab Returns the extension of the receiver'27s path representation. Given the path 'aa/Images/Bloggs.tiff'ba, this method returns a string containing 'aatiff'ba. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b stringByAbbreviatingWithTildeInPath s9 li7030 fi-6553 fi-5796 b0 tab Returns a string in which the user'27s home directory path is replace by 'aa~'ba. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b stringByAppendingPathComponent:b0 (NSString *)i aString s9 li7030 fi-6553 fi-5796 i0 tab Returns a string representing the receiver'27s path with the addition of the path component i aStringi0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b stringByAppendingPathExtension:b0 (NSString *)i aString s9 li7030 fi-6553 fi-5796 i0 tab Returns a string representing the receiver'27s path with the addition of the extension i aStringi0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b stringByDeletingLastPathComponent s9 li7030 fi-6553 fi-5796 b0 tab Returns the receiver'27s path representation minus the last component. Given the path 'aa/Images/Bloggs.tiff'ba, this method returns a string containing 'aa/Images'ba. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b stringByDeletingPathExtensionb0 tab Returns the receiver'27s path representation minus the extension on the last component. Given the path 'aa/Images/Bloggs.tiff'ba, this method returns a string containing 'aa/Images/Bloggs'ba. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b stringByExpandingTildeInPathb0 tab Returns a string in which a tilde is expanded to its full path equivalent. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b stringByResolvingSymlinksInPathb0 tab Returns a string identical to the receiver'27s path except that any symbolic links have been resolved. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b stringByStandardizingPathb0 tab Returns a string containing a 'aastandardized'ba path, one in which tildes are expanded and redundant elements (for example 'aa//'ba) eliminated. fi-6552 fs16 fs28 fi-6552 }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.