1995-03-18 17:15:15 +00:00
|
|
|
/* Interface for NSObject for GNUStep
|
1999-11-26 19:43:43 +00:00
|
|
|
Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc.
|
1995-07-01 19:01:11 +00:00
|
|
|
|
1996-04-17 20:17:45 +00:00
|
|
|
Written by: Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
|
1995-07-01 19:01:11 +00:00
|
|
|
Date: 1995
|
1995-03-18 17:15:15 +00:00
|
|
|
|
1996-05-12 00:56:10 +00:00
|
|
|
This file is part of the GNUstep Base Library.
|
1995-03-18 17:15:15 +00:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; if not, write to the Free
|
2005-05-22 03:32:16 +00:00
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
1995-03-18 17:15:15 +00:00
|
|
|
*/
|
|
|
|
|
1996-04-17 19:36:35 +00:00
|
|
|
#ifndef __NSString_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define __NSString_h_GNUSTEP_BASE_INCLUDE
|
1995-03-18 17:15:15 +00:00
|
|
|
|
2000-06-14 04:03:56 +00:00
|
|
|
#include <Foundation/NSObject.h>
|
1995-04-17 21:13:20 +00:00
|
|
|
#include <Foundation/NSRange.h>
|
1995-03-23 03:28:06 +00:00
|
|
|
|
2004-07-29 15:30:47 +00:00
|
|
|
/**
|
|
|
|
* Type for representing unicode characters. (16-bit)
|
|
|
|
*/
|
1995-03-23 03:28:06 +00:00
|
|
|
typedef unsigned short unichar;
|
|
|
|
|
|
|
|
@class NSArray;
|
|
|
|
@class NSCharacterSet;
|
1995-04-03 01:42:02 +00:00
|
|
|
@class NSData;
|
1995-03-23 03:28:06 +00:00
|
|
|
@class NSDictionary;
|
2000-09-22 13:45:58 +00:00
|
|
|
#ifndef STRICT_OPENSTEP
|
2000-09-12 23:08:40 +00:00
|
|
|
@class NSURL;
|
2000-09-22 13:45:58 +00:00
|
|
|
#endif
|
1995-03-23 03:28:06 +00:00
|
|
|
|
|
|
|
#define NSMaximumStringLength (INT_MAX-1)
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
NSCaseInsensitiveSearch = 1,
|
|
|
|
NSLiteralSearch = 2,
|
|
|
|
NSBackwardsSearch = 4,
|
|
|
|
NSAnchoredSearch = 8
|
|
|
|
};
|
|
|
|
|
2004-07-29 15:30:47 +00:00
|
|
|
/**
|
|
|
|
* <p>Enumeration of available encodings for converting between bytes and
|
|
|
|
* characters (in [NSString]s). The ones that are shared with OpenStep and
|
|
|
|
* Cocoa are: <code>NSASCIIStringEncoding, NSNEXTSTEPStringEncoding,
|
|
|
|
* NSJapaneseEUCStringEncoding, NSUTF8StringEncoding,
|
|
|
|
* NSISOLatin1StringEncoding, NSSymbolStringEncoding,
|
|
|
|
* NSNonLossyASCIIStringEncoding, NSShiftJISStringEncoding,
|
|
|
|
* NSISOLatin2StringEncoding, NSUnicodeStringEncoding,
|
|
|
|
* NSWindowsCP1251StringEncoding, NSWindowsCP1252StringEncoding,
|
|
|
|
* NSWindowsCP1253StringEncoding, NSWindowsCP1254StringEncoding,
|
|
|
|
* NSWindowsCP1250StringEncoding, NSISO2022JPStringEncoding,
|
|
|
|
* NSMacOSRomanStringEncoding, NSProprietaryStringEncoding</code>.</p>
|
|
|
|
*
|
|
|
|
* <p>Additional encodings available under GNUstep are:
|
|
|
|
* <code>NSKOI8RStringEncoding, NSISOLatin3StringEncoding,
|
|
|
|
* NSISOLatin4StringEncoding, NSISOCyrillicStringEncoding,
|
|
|
|
* NSISOArabicStringEncoding, NSISOGreekStringEncoding,
|
|
|
|
* NSISOHebrewStringEncoding, NSISOLatin5StringEncoding,
|
|
|
|
* NSISOLatin6StringEncoding, NSISOThaiStringEncoding,
|
|
|
|
* NSISOLatin7StringEncoding, NSISOLatin8StringEncoding,
|
|
|
|
* NSISOLatin9StringEncoding, NSGB2312StringEncoding, NSUTF7StringEncoding,
|
|
|
|
* NSGSM0338StringEncoding, NSBIG5StringEncoding,
|
|
|
|
* NSKoreanEUCStringEncoding</code>.</p>
|
|
|
|
*/
|
1998-01-08 15:25:59 +00:00
|
|
|
typedef enum _NSStringEncoding
|
|
|
|
{
|
1998-06-24 22:01:40 +00:00
|
|
|
/* NB. Must not have an encoding with value zero - so we can use zero to
|
|
|
|
tell that a variable that should contain an encoding has not yet been
|
|
|
|
initialised */
|
1999-11-26 19:43:43 +00:00
|
|
|
GSUndefinedEncoding = 0,
|
|
|
|
NSASCIIStringEncoding = 1,
|
|
|
|
NSNEXTSTEPStringEncoding = 2,
|
|
|
|
NSJapaneseEUCStringEncoding = 3,
|
|
|
|
NSUTF8StringEncoding = 4,
|
2001-03-12 14:42:52 +00:00
|
|
|
NSISOLatin1StringEncoding = 5, // ISO-8859-1; West European
|
1999-11-26 19:43:43 +00:00
|
|
|
NSSymbolStringEncoding = 6,
|
|
|
|
NSNonLossyASCIIStringEncoding = 7,
|
|
|
|
NSShiftJISStringEncoding = 8,
|
2001-03-12 14:42:52 +00:00
|
|
|
NSISOLatin2StringEncoding = 9, // ISO-8859-2; East European
|
1999-11-26 19:43:43 +00:00
|
|
|
NSUnicodeStringEncoding = 10,
|
|
|
|
NSWindowsCP1251StringEncoding = 11,
|
2001-03-12 14:42:52 +00:00
|
|
|
NSWindowsCP1252StringEncoding = 12, // WinLatin1
|
|
|
|
NSWindowsCP1253StringEncoding = 13, // Greek
|
|
|
|
NSWindowsCP1254StringEncoding = 14, // Turkish
|
|
|
|
NSWindowsCP1250StringEncoding = 15, // WinLatin2
|
1999-11-26 19:43:43 +00:00
|
|
|
NSISO2022JPStringEncoding = 21,
|
2000-09-02 01:41:29 +00:00
|
|
|
NSMacOSRomanStringEncoding = 30,
|
|
|
|
NSProprietaryStringEncoding = 31,
|
|
|
|
|
1998-01-08 15:25:59 +00:00
|
|
|
// GNUstep additions
|
2001-03-12 14:42:52 +00:00
|
|
|
NSKOI8RStringEncoding = 50, // Russian/Cyrillic
|
|
|
|
NSISOLatin3StringEncoding = 51, // ISO-8859-3; South European
|
|
|
|
NSISOLatin4StringEncoding = 52, // ISO-8859-4; North European
|
|
|
|
NSISOCyrillicStringEncoding = 22, // ISO-8859-5
|
|
|
|
NSISOArabicStringEncoding = 53, // ISO-8859-6
|
|
|
|
NSISOGreekStringEncoding = 54, // ISO-8859-7
|
|
|
|
NSISOHebrewStringEncoding = 55, // ISO-8859-8
|
|
|
|
NSISOLatin5StringEncoding = 57, // ISO-8859-9; Turkish
|
|
|
|
NSISOLatin6StringEncoding = 58, // ISO-8859-10; Nordic
|
|
|
|
NSISOThaiStringEncoding = 59, // ISO-8859-11
|
2002-10-22 14:29:34 +00:00
|
|
|
/* Possible future ISO-8859 additions
|
2001-03-12 14:42:52 +00:00
|
|
|
// ISO-8859-12
|
|
|
|
*/
|
|
|
|
NSISOLatin7StringEncoding = 61, // ISO-8859-13
|
|
|
|
NSISOLatin8StringEncoding = 62, // ISO-8859-14
|
|
|
|
NSISOLatin9StringEncoding = 63, // ISO-8859-15; Replaces ISOLatin1
|
|
|
|
NSGB2312StringEncoding = 56,
|
2002-01-24 17:03:04 +00:00
|
|
|
NSUTF7StringEncoding = 64, // RFC 2152
|
2002-03-08 11:50:42 +00:00
|
|
|
NSGSM0338StringEncoding, // GSM (mobile phone) default alphabet
|
2003-09-08 02:36:49 +00:00
|
|
|
NSBIG5StringEncoding, // Traditional chinese
|
2003-11-24 04:18:50 +00:00
|
|
|
NSKoreanEUCStringEncoding // Korean
|
1998-01-08 15:25:59 +00:00
|
|
|
} NSStringEncoding;
|
|
|
|
|
|
|
|
enum {
|
1999-11-26 19:43:43 +00:00
|
|
|
NSOpenStepUnicodeReservedBase = 0xF400
|
1998-01-08 15:25:59 +00:00
|
|
|
};
|
|
|
|
|
2004-08-26 13:43:34 +00:00
|
|
|
/**
|
|
|
|
* <p>
|
|
|
|
* <code>NSString</code> objects represent an immutable string of Unicode 3.0
|
|
|
|
* characters. These may be accessed individually as type
|
|
|
|
* <code>unichar</code>, an unsigned short.<br/>
|
|
|
|
* The [NSMutableString] subclass represents a modifiable string. Both are
|
|
|
|
* implemented as part of a class cluster and the instances you receive may
|
|
|
|
* actually be of unspecified concrete subclasses.
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* A constant <code>NSString</code> can be created using the following syntax:
|
|
|
|
* <code>@"..."</code>, where the contents of the quotes are the
|
|
|
|
* string, using only ASCII characters.
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* A variable string can be created using a C printf-like <em>format</em>,
|
|
|
|
* as in <code>[NSString stringWithFormat: @"Total is %f", t]</code>.
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* To create a concrete subclass of <code>NSString</code>, you must have your
|
|
|
|
* class inherit from <code>NSString</code> and override at least the two
|
|
|
|
* primitive methods - -length and -characterAtIndex:
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* 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 <em>designated initialiser</em> and the other
|
|
|
|
* initialisation methods should work.
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* Where an NSString instance method returns an NSString object,
|
|
|
|
* the class of the actual object returned may be any subclass
|
|
|
|
* of NSString. The actual value returned may be a new
|
|
|
|
* autoreleased object, an autoreleased copy of the receiver,
|
|
|
|
* or the receiver itsself. While the abstract base class
|
|
|
|
* implementations of methods (other than initialisers) will
|
|
|
|
* avoid returning mutable strings by returning an autoreleased
|
|
|
|
* copy of a mutable receiver, concrete subclasses may behave
|
|
|
|
* differently, so code should not rely upon the mutability of
|
2004-09-05 02:31:35 +00:00
|
|
|
* returned strings nor upon their lifetime being greater than
|
2004-08-26 13:43:34 +00:00
|
|
|
* that of the receiver which returned them.
|
|
|
|
* </p>
|
|
|
|
*/
|
2002-03-13 13:46:12 +00:00
|
|
|
@interface NSString :NSObject <NSCoding, NSCopying, NSMutableCopying>
|
1995-03-23 03:28:06 +00:00
|
|
|
|
2005-03-21 12:29:02 +00:00
|
|
|
#ifndef NO_GNUSTEP
|
|
|
|
/**
|
|
|
|
* Sets the path handling mode for the NSString path manipulation methods.<br />
|
|
|
|
* <em>unix</em> mode treats paths as Unix/POSIX paths in which a slash (/)
|
|
|
|
* is the only path separator, and a single leading slash indicates an
|
|
|
|
* absolute path.<br />
|
|
|
|
* <em>windows</em> mode treats paths as windows drive-relative or UNC paths
|
|
|
|
* in which either slash (/) or backslash (\) may be used as path separators
|
|
|
|
* and the 'root' of a path may be of the form 'C:/' or '//host/share/'.<br />
|
|
|
|
* The mode selected if you provide any other argument to this
|
|
|
|
* method is the default <em>gnustep</em> mode, in which the system tries
|
|
|
|
* to <em>do-the-right-thing</em> and support both windows and unix style
|
|
|
|
* paths at the same time.
|
|
|
|
*/
|
|
|
|
+ (void) setPathHandling: (NSString*)mode;
|
|
|
|
#endif
|
1999-11-26 19:43:43 +00:00
|
|
|
+ (id) string;
|
|
|
|
+ (id) stringWithCharacters: (const unichar*)chars
|
|
|
|
length: (unsigned int)length;
|
2005-05-08 07:08:28 +00:00
|
|
|
#ifndef STRICT_OPENSTEP
|
|
|
|
+ (id) stringWithCString: (const char*)byteString
|
|
|
|
encoding: (NSStringEncoding)encoding;
|
|
|
|
#endif
|
1999-11-26 19:43:43 +00:00
|
|
|
+ (id) stringWithCString: (const char*)byteString
|
|
|
|
length: (unsigned int)length;
|
2005-05-08 07:08:28 +00:00
|
|
|
+ (id) stringWithCString: (const char*)byteString;
|
1999-11-26 19:43:43 +00:00
|
|
|
+ (id) stringWithFormat: (NSString*)format,...;
|
|
|
|
+ (id) stringWithContentsOfFile:(NSString *)path;
|
1995-03-23 03:28:06 +00:00
|
|
|
|
|
|
|
// Initializing Newly Allocated Strings
|
2004-09-07 05:43:20 +00:00
|
|
|
- (id) init;
|
2004-01-30 07:17:30 +00:00
|
|
|
#ifndef STRICT_OPENSTEP
|
|
|
|
- (id) initWithBytes: (const void*)bytes
|
|
|
|
length: (unsigned int)length
|
2004-01-30 11:30:56 +00:00
|
|
|
encoding: (NSStringEncoding)encoding;
|
2004-01-30 07:17:30 +00:00
|
|
|
- (id) initWithBytesNoCopy: (const void*)bytes
|
|
|
|
length: (unsigned int)length
|
|
|
|
encoding: (NSStringEncoding)encoding
|
|
|
|
freeWhenDone: (BOOL)flag;
|
|
|
|
#endif
|
1996-11-24 21:00:28 +00:00
|
|
|
- (id) initWithCharactersNoCopy: (unichar*)chars
|
1999-11-26 19:43:43 +00:00
|
|
|
length: (unsigned int)length
|
|
|
|
freeWhenDone: (BOOL)flag;
|
1995-03-23 03:28:06 +00:00
|
|
|
- (id) initWithCharacters: (const unichar*)chars
|
1999-11-26 19:43:43 +00:00
|
|
|
length: (unsigned int)length;
|
1996-11-24 21:00:28 +00:00
|
|
|
- (id) initWithCStringNoCopy: (char*)byteString
|
1999-11-26 19:43:43 +00:00
|
|
|
length: (unsigned int)length
|
|
|
|
freeWhenDone: (BOOL)flag;
|
1996-11-24 21:00:28 +00:00
|
|
|
- (id) initWithCString: (const char*)byteString
|
1999-11-26 19:43:43 +00:00
|
|
|
length: (unsigned int)length;
|
1996-11-24 21:00:28 +00:00
|
|
|
- (id) initWithCString: (const char*)byteString;
|
|
|
|
- (id) initWithString: (NSString*)string;
|
2001-11-12 13:01:09 +00:00
|
|
|
- (id) initWithFormat: (NSString*)format, ...;
|
1995-03-23 03:28:06 +00:00
|
|
|
- (id) initWithFormat: (NSString*)format
|
1999-11-26 19:43:43 +00:00
|
|
|
arguments: (va_list)argList;
|
1996-11-24 21:00:28 +00:00
|
|
|
- (id) initWithData: (NSData*)data
|
1999-11-26 19:43:43 +00:00
|
|
|
encoding: (NSStringEncoding)encoding;
|
1996-11-24 21:00:28 +00:00
|
|
|
- (id) initWithContentsOfFile: (NSString*)path;
|
|
|
|
- (id) init;
|
1995-03-23 03:28:06 +00:00
|
|
|
|
|
|
|
// Getting a String's Length
|
|
|
|
- (unsigned int) length;
|
|
|
|
|
|
|
|
// Accessing Characters
|
|
|
|
- (unichar) characterAtIndex: (unsigned int)index;
|
|
|
|
- (void) getCharacters: (unichar*)buffer;
|
|
|
|
- (void) getCharacters: (unichar*)buffer
|
1999-11-26 19:43:43 +00:00
|
|
|
range: (NSRange)aRange;
|
1995-03-23 03:28:06 +00:00
|
|
|
|
|
|
|
// Combining Strings
|
|
|
|
- (NSString*) stringByAppendingFormat: (NSString*)format,...;
|
|
|
|
- (NSString*) stringByAppendingString: (NSString*)aString;
|
|
|
|
|
|
|
|
// Dividing Strings into Substrings
|
|
|
|
- (NSArray*) componentsSeparatedByString: (NSString*)separator;
|
|
|
|
- (NSString*) substringFromIndex: (unsigned int)index;
|
|
|
|
- (NSString*) substringFromRange: (NSRange)aRange;
|
|
|
|
- (NSString*) substringToIndex: (unsigned int)index;
|
|
|
|
|
|
|
|
// Finding Ranges of Characters and Substrings
|
|
|
|
- (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet;
|
|
|
|
- (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet
|
1999-11-26 19:43:43 +00:00
|
|
|
options: (unsigned int)mask;
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSRange) rangeOfCharacterFromSet: (NSCharacterSet*)aSet
|
1999-11-26 19:43:43 +00:00
|
|
|
options: (unsigned int)mask
|
|
|
|
range: (NSRange)aRange;
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSRange) rangeOfString: (NSString*)string;
|
|
|
|
- (NSRange) rangeOfString: (NSString*)string
|
1999-11-26 19:43:43 +00:00
|
|
|
options: (unsigned int)mask;
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSRange) rangeOfString: (NSString*)aString
|
1999-11-26 19:43:43 +00:00
|
|
|
options: (unsigned int)mask
|
|
|
|
range: (NSRange)aRange;
|
1995-03-23 03:28:06 +00:00
|
|
|
|
|
|
|
// Determining Composed Character Sequences
|
|
|
|
- (NSRange) rangeOfComposedCharacterSequenceAtIndex: (unsigned int)anIndex;
|
|
|
|
|
1996-11-24 21:00:28 +00:00
|
|
|
// Converting String Contents into a Property List
|
|
|
|
- (id)propertyList;
|
|
|
|
- (NSDictionary*) propertyListFromStringsFileFormat;
|
1995-03-23 03:28:06 +00:00
|
|
|
|
1996-11-24 21:00:28 +00:00
|
|
|
// Identifying and Comparing Strings
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSComparisonResult) compare: (NSString*)aString;
|
|
|
|
- (NSComparisonResult) compare: (NSString*)aString
|
1999-11-26 19:43:43 +00:00
|
|
|
options: (unsigned int)mask;
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSComparisonResult) compare: (NSString*)aString
|
1999-11-26 19:43:43 +00:00
|
|
|
options: (unsigned int)mask
|
|
|
|
range: (NSRange)aRange;
|
1995-03-23 03:28:06 +00:00
|
|
|
- (BOOL) hasPrefix: (NSString*)aString;
|
|
|
|
- (BOOL) hasSuffix: (NSString*)aString;
|
|
|
|
- (BOOL) isEqual: (id)anObject;
|
|
|
|
- (BOOL) isEqualToString: (NSString*)aString;
|
1996-11-24 21:00:28 +00:00
|
|
|
- (unsigned int) hash;
|
1995-03-23 03:28:06 +00:00
|
|
|
|
|
|
|
// Getting a Shared Prefix
|
|
|
|
- (NSString*) commonPrefixWithString: (NSString*)aString
|
1999-11-26 19:43:43 +00:00
|
|
|
options: (unsigned int)mask;
|
1995-03-23 03:28:06 +00:00
|
|
|
|
|
|
|
// Changing Case
|
|
|
|
- (NSString*) capitalizedString;
|
|
|
|
- (NSString*) lowercaseString;
|
|
|
|
- (NSString*) uppercaseString;
|
|
|
|
|
|
|
|
// Getting C Strings
|
|
|
|
- (const char*) cString;
|
2005-05-08 07:08:28 +00:00
|
|
|
#ifndef STRICT_OPENSTEP
|
2005-05-09 09:01:06 +00:00
|
|
|
|
|
|
|
#if OS_API_VERSION(1004,9999) && GS_API_VERSION(0102,9999)
|
2005-05-08 07:08:28 +00:00
|
|
|
- (const char*) cStringUsingEncoding: (NSStringEncoding)encoding;
|
|
|
|
- (void) getCString: (char*)buffer
|
|
|
|
maxLength: (unsigned int)maxLength
|
|
|
|
encoding: (NSStringEncoding)encoding;
|
|
|
|
- (id) initWithCString: (const char*)byteString
|
|
|
|
encoding: (NSStringEncoding)encoding;
|
|
|
|
- (unsigned) lengthOfBytesUsingEncoding: (NSStringEncoding)encoding;
|
|
|
|
- (unsigned) maximumLengthOfBytesUsingEncoding: (NSStringEncoding)encoding;
|
2005-05-09 09:01:06 +00:00
|
|
|
#endif
|
|
|
|
|
2005-05-08 07:08:28 +00:00
|
|
|
#endif
|
1995-03-23 03:28:06 +00:00
|
|
|
- (unsigned int) cStringLength;
|
|
|
|
- (void) getCString: (char*)buffer;
|
|
|
|
- (void) getCString: (char*)buffer
|
1999-11-26 19:43:43 +00:00
|
|
|
maxLength: (unsigned int)maxLength;
|
1995-03-23 03:28:06 +00:00
|
|
|
- (void) getCString: (char*)buffer
|
1999-11-26 19:43:43 +00:00
|
|
|
maxLength: (unsigned int)maxLength
|
|
|
|
range: (NSRange)aRange
|
|
|
|
remainingRange: (NSRange*)leftoverRange;
|
1995-03-23 03:28:06 +00:00
|
|
|
|
|
|
|
// Getting Numeric Values
|
|
|
|
- (float) floatValue;
|
|
|
|
- (int) intValue;
|
|
|
|
|
|
|
|
// Working With Encodings
|
|
|
|
- (BOOL) canBeConvertedToEncoding: (NSStringEncoding)encoding;
|
|
|
|
- (NSData*) dataUsingEncoding: (NSStringEncoding)encoding;
|
|
|
|
- (NSData*) dataUsingEncoding: (NSStringEncoding)encoding
|
1999-11-26 19:43:43 +00:00
|
|
|
allowLossyConversion: (BOOL)flag;
|
1996-11-24 21:00:28 +00:00
|
|
|
+ (NSStringEncoding) defaultCStringEncoding;
|
|
|
|
- (NSString*) description;
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSStringEncoding) fastestEncoding;
|
|
|
|
- (NSStringEncoding) smallestEncoding;
|
|
|
|
|
2005-03-21 12:29:02 +00:00
|
|
|
/**
|
|
|
|
* Attempts to complete this string as a path in the filesystem by finding
|
|
|
|
* a unique completion if one exists and returning it by reference in
|
|
|
|
* outputName (which must be a non-nil pointer), or if it finds a set of
|
|
|
|
* completions they are returned by reference in outputArray, if it is non-nil.
|
|
|
|
* filterTypes can be an array of strings specifying extensions to consider;
|
|
|
|
* files without these extensions will be ignored and will not constitute
|
|
|
|
* completions. Returns 0 if no match found, else a positive number that is
|
|
|
|
* only accurate if outputArray was non-nil.
|
|
|
|
*/
|
1995-03-23 03:28:06 +00:00
|
|
|
- (unsigned int) completePathIntoString: (NSString**)outputName
|
1999-11-26 19:43:43 +00:00
|
|
|
caseSensitive: (BOOL)flag
|
|
|
|
matchesIntoArray: (NSArray**)outputArray
|
|
|
|
filterTypes: (NSArray*)filterTypes;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Converts the receiver to a C string path expressed in the character
|
|
|
|
* encoding appropriate for the local host file system. This string will be
|
|
|
|
* automatically freed soon after it is returned, so copy it if you need it
|
|
|
|
* for long.
|
|
|
|
*/
|
1997-11-03 01:40:03 +00:00
|
|
|
- (const char*) fileSystemRepresentation;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Converts the receiver to a C string path using the character encoding
|
|
|
|
* appropriate to the local file system. This string will be
|
|
|
|
* stored into buffer if it is shorter than size, otherwise NO is returned.
|
|
|
|
*/
|
2002-03-13 13:46:12 +00:00
|
|
|
- (BOOL) getFileSystemRepresentation: (char*)buffer
|
|
|
|
maxLength: (unsigned int)size;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a string containing the last path component of the receiver.<br />
|
|
|
|
* The path component is the last non-empty substring delimited by the ends
|
|
|
|
* of the string, or by path separator characters.<br />
|
|
|
|
* If the receiver only contains a root part, this method returns it.<br />
|
|
|
|
* If there are no non-empty substrings, this returns an empty string.<br />
|
|
|
|
* NB. In a windows UNC path, the host and share specification is treated as
|
|
|
|
* a single path component, even though it contains separators.
|
|
|
|
* So a string of the form '//host/share' may be returned.<br />
|
|
|
|
* Other special cases are apply when the string is the root.
|
|
|
|
* <example>
|
|
|
|
* @"foo/bar" produces @"bar"
|
|
|
|
* @"foo/bar/" produces @"bar"
|
|
|
|
* @"/foo/bar" produces @"bar"
|
|
|
|
* @"/foo" produces @"foo"
|
|
|
|
* @"/" produces @"/" (root is a special case)
|
|
|
|
* @"" produces @""
|
|
|
|
* @"C:/" produces @"C:/" (root is a special case)
|
|
|
|
* @"C:" produces @"C:"
|
|
|
|
* @"//host/share/" produces @"//host/share/" (root is a special case)
|
|
|
|
* @"//host/share" produces @"//host/share"
|
|
|
|
* </example>
|
|
|
|
*/
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSString*) lastPathComponent;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a new string containing the path extension of the receiver.<br />
|
|
|
|
* 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).<br />
|
|
|
|
* Returns an empty string if no such extension exists.
|
|
|
|
* <example>
|
|
|
|
* @"a.b" produces @"b"
|
|
|
|
* @"a.b/" produces @"b"
|
|
|
|
* @"/path/a.ext" produces @"ext"
|
|
|
|
* @"/path/a." produces @""
|
|
|
|
* @"/path/.a" produces @"" (.a is not an extension to a file)
|
|
|
|
* @".a" produces @"" (.a is not an extension to a file)
|
|
|
|
* </example>
|
|
|
|
*/
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSString*) pathExtension;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a string where a prefix of the current user's home directory is
|
|
|
|
* abbreviated by '~', or returns the receiver (or an immutable copy) if
|
|
|
|
* it was not found to have the home directory as a prefix.
|
|
|
|
*/
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSString*) stringByAbbreviatingWithTildeInPath;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a new string with the path component given in aString
|
|
|
|
* appended to the receiver.<br />
|
|
|
|
* This removes trailing path separators from the receiver and the root
|
|
|
|
* part from aString and replaces them with a single slash as a path
|
|
|
|
* separator.<br />
|
|
|
|
* Also condenses any multiple separator sequences in the result into
|
|
|
|
* single path separators.
|
|
|
|
* <example>
|
|
|
|
* @"" with @"file" produces @"file"
|
|
|
|
* @"path" with @"file" produces @"path/file"
|
|
|
|
* @"/" with @"file" produces @"/file"
|
|
|
|
* @"/" with @"file" produces @"/file"
|
|
|
|
* @"/" with @"/file" produces @"/file"
|
|
|
|
* @"path with @"C:/file" produces @"path/file"
|
|
|
|
* </example>
|
|
|
|
*/
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSString*) stringByAppendingPathComponent: (NSString*)aString;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a new string with the path extension given in aString
|
|
|
|
* appended to the receiver after an extensionSeparator ('.').<br />
|
|
|
|
* If the receiver has trailing path separator characters, they are
|
|
|
|
* stripped before the extension separator is added.<br />
|
|
|
|
* If the receiver contains no components after the root, the extension
|
|
|
|
* cannot be apppended (an extension can only be appended to a file name),
|
|
|
|
* so a copy of the unmodified receiver is returned.<br />
|
|
|
|
* An empty string may be used as an extension ... in which case the extension
|
|
|
|
* separator is appended.<br />
|
|
|
|
* This behavior mirrors that of the -stringByDeletingPathExtension method.
|
|
|
|
* <example>
|
|
|
|
* @"Mail" with @"app" produces @"Mail.app"
|
|
|
|
* @"Mail.app" with @"old" produces @"Mail.app.old"
|
|
|
|
* @"file" with @"" produces @"file."
|
|
|
|
* @"/" with @"app" produces @"/" (no file name to append to)
|
|
|
|
* @"" with @"app" produces @"" (no file name to append to)
|
|
|
|
* </example>
|
|
|
|
*/
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSString*) stringByAppendingPathExtension: (NSString*)aString;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a new string with the last path component (including any final
|
|
|
|
* path separators) removed from the receiver.<br />
|
|
|
|
* A string without a path component other than the root is returned
|
|
|
|
* without alteration.<br />
|
|
|
|
* See -lastPathComponent for a definition of a path component.
|
|
|
|
* <example>
|
|
|
|
* @"hello/there" produces @"hello"
|
|
|
|
* @"hello" produces @""
|
|
|
|
* @"/hello" produces @"/"
|
|
|
|
* @"/" produces @"/"
|
|
|
|
* @"C:file" produces @"C:"
|
|
|
|
* @"C:" produces @"C:"
|
|
|
|
* @"C:/file" produces @"C:/"
|
|
|
|
* @"C:/" produces @"C:/"
|
|
|
|
* @"//host/share/file" produces @"//host/share/"
|
|
|
|
* @"//host/share/" produces @"/host/share/"
|
|
|
|
* @"//host/share" produces @"/host/share"
|
2005-04-01 10:57:35 +00:00
|
|
|
* </example>
|
2005-03-21 12:29:02 +00:00
|
|
|
*/
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSString*) stringByDeletingLastPathComponent;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a new string with the path extension removed from the receiver.<br />
|
|
|
|
* Strips any trailing path separators before checking for the extension
|
|
|
|
* separator.<br />
|
|
|
|
* NB. This method does not consider a string which contains nothing
|
|
|
|
* between the root part and the extension separator ('.') to be a path
|
|
|
|
* extension. This mirrors the behavior of the -stringByAppendingPathExtension:
|
|
|
|
* method.
|
|
|
|
* <example>
|
|
|
|
* @"file.ext" produces @"file"
|
|
|
|
* @"/file.ext" produces @"/file"
|
|
|
|
* @"/file.ext/" produces @"/file" (trailing path separators are ignored)
|
|
|
|
* @"/file..ext" produces @"/file."
|
|
|
|
* @"/file." produces @"/file"
|
|
|
|
* @"/.ext" produces @"/.ext" (there is no file to strip from)
|
|
|
|
* @".ext" produces @".ext" (there is no file to strip from)
|
|
|
|
* </example>
|
|
|
|
*/
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSString*) stringByDeletingPathExtension;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.<br />
|
|
|
|
* Returns the receiver or an immutable copy if it was not possible to
|
|
|
|
* expand it.
|
|
|
|
*/
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSString*) stringByExpandingTildeInPath;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Replaces path string by one in which path components representing symbolic
|
|
|
|
* links have been replaced by their referents.<br />
|
|
|
|
* If links cannot be resolved, returns an unmodified coopy of the receiver.
|
|
|
|
*/
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSString*) stringByResolvingSymlinksInPath;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a standardised form of the receiver, with unnecessary parts
|
|
|
|
* removed, tilde characters expanded, and symbolic links resolved
|
|
|
|
* where possible.<br />
|
|
|
|
* NB. Refers to the local filesystem to resolve symbolic links in
|
|
|
|
* absolute paths, and to expand tildes ... so this can't be used for
|
|
|
|
* general path manipulation.<br />
|
|
|
|
* If the string is an invalid path, the unmodified receiver is returned.<br />
|
|
|
|
* <p>
|
|
|
|
* Uses -stringByExpandingTildeInPath to expand tilde expressions.<br />
|
|
|
|
* Simplifies '//' and '/./' sequences and removes trailing '/' or '.'.<br />
|
|
|
|
* </p>
|
|
|
|
* <p>
|
|
|
|
* For absolute paths, uses -stringByResolvingSymlinksInPath to resolve
|
|
|
|
* any links, then gets rid of '/../' sequences and removes any '/private'
|
|
|
|
* prefix.
|
|
|
|
* </p>
|
|
|
|
*/
|
1995-03-23 03:28:06 +00:00
|
|
|
- (NSString*) stringByStandardizingPath;
|
|
|
|
|
2002-08-30 08:36:20 +00:00
|
|
|
|
1997-05-03 18:05:21 +00:00
|
|
|
// for methods working with decomposed strings
|
|
|
|
- (int) _baseLength;
|
|
|
|
|
1996-11-24 21:00:28 +00:00
|
|
|
#ifndef STRICT_OPENSTEP
|
2005-03-21 12:29:02 +00:00
|
|
|
/**
|
|
|
|
* Concatenates the path components in the array and returns the result.<br />
|
|
|
|
* This method does not remove empty path components, but does recognize an
|
|
|
|
* empty initial component as a special case meaning that the string
|
|
|
|
* returned will begin with a slash.
|
|
|
|
*/
|
1998-01-21 15:09:22 +00:00
|
|
|
+ (NSString*) pathWithComponents: (NSArray*)components;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns YES if the receiver represents an absolute path ...<br />
|
|
|
|
* Returns NO otherwise.<br />
|
|
|
|
* An absolute path in unix mode is one which begins
|
|
|
|
* with a slash or tilde.<br />
|
2005-03-31 19:47:41 +00:00
|
|
|
* In windows mode a drive specification (eg C:) followed by a slash or
|
|
|
|
* backslash, is an absolute path, as is any path beginning with a tilde.<br />
|
|
|
|
* In any mode a UNC path (//host/share...) is always absolute.<br />
|
2005-03-21 12:29:02 +00:00
|
|
|
* In gnustep path handling mode, the rules are the same as for windows,
|
|
|
|
* except that a path whose root is a slash denotes an absolute path
|
|
|
|
* when running on unix and a relative path when running under windows.
|
|
|
|
*/
|
1998-01-21 15:09:22 +00:00
|
|
|
- (BOOL) isAbsolutePath;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the path components of the receiver separated into an array.<br />
|
|
|
|
* If the receiver begins with a root sequence such as the path separator
|
|
|
|
* character (or a drive specification in windows) then that is used as the
|
|
|
|
* first element in the array.<br />
|
|
|
|
* Empty components are removed.<br />
|
|
|
|
* A trailing path separator (which was not part of the root) is added as the
|
|
|
|
* last element in the array.
|
|
|
|
*/
|
1998-01-21 15:09:22 +00:00
|
|
|
- (NSArray*) pathComponents;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an array of strings made by appending the values in paths
|
|
|
|
* to the receiver.
|
|
|
|
*/
|
1998-01-21 15:09:22 +00:00
|
|
|
- (NSArray*) stringsByAppendingPaths: (NSArray*)paths;
|
2005-03-21 12:29:02 +00:00
|
|
|
|
2005-05-08 07:08:28 +00:00
|
|
|
+ (NSString*) localizedStringWithFormat: (NSString*)format, ...;
|
2000-06-23 14:52:22 +00:00
|
|
|
|
2005-05-08 07:08:28 +00:00
|
|
|
+ (id) stringWithString: (NSString*)aString;
|
2002-03-13 13:46:12 +00:00
|
|
|
+ (id) stringWithContentsOfURL: (NSURL*)url;
|
2000-09-22 13:45:58 +00:00
|
|
|
+ (id) stringWithUTF8String: (const char*)bytes;
|
1996-11-24 21:00:28 +00:00
|
|
|
- (id) initWithFormat: (NSString*)format
|
2002-03-13 13:46:12 +00:00
|
|
|
locale: (NSDictionary*)locale, ...;
|
1996-11-24 21:00:28 +00:00
|
|
|
- (id) initWithFormat: (NSString*)format
|
2002-03-13 13:46:12 +00:00
|
|
|
locale: (NSDictionary*)locale
|
2002-06-09 07:31:58 +00:00
|
|
|
arguments: (va_list)argList;
|
2000-09-22 13:45:58 +00:00
|
|
|
- (id) initWithUTF8String: (const char *)bytes;
|
2002-03-13 13:46:12 +00:00
|
|
|
- (id) initWithContentsOfURL: (NSURL*)url;
|
1997-12-08 20:04:16 +00:00
|
|
|
- (NSString*) substringWithRange: (NSRange)aRange;
|
1996-11-24 21:00:28 +00:00
|
|
|
- (NSComparisonResult) caseInsensitiveCompare: (NSString*)aString;
|
2002-08-30 08:36:20 +00:00
|
|
|
- (NSComparisonResult) compare: (NSString*)string
|
|
|
|
options: (unsigned int)mask
|
|
|
|
range: (NSRange)compareRange
|
|
|
|
locale: (NSDictionary*)dict;
|
|
|
|
- (NSComparisonResult) localizedCompare: (NSString *)string;
|
|
|
|
- (NSComparisonResult) localizedCaseInsensitiveCompare: (NSString *)string;
|
1996-11-24 21:00:28 +00:00
|
|
|
- (BOOL) writeToFile: (NSString*)filename
|
1999-08-25 14:47:19 +00:00
|
|
|
atomically: (BOOL)useAuxiliaryFile;
|
2002-08-30 08:36:20 +00:00
|
|
|
- (BOOL) writeToURL: (NSURL*)anURL atomically: (BOOL)atomically;
|
1996-11-24 21:00:28 +00:00
|
|
|
- (double) doubleValue;
|
1999-11-26 19:43:43 +00:00
|
|
|
+ (NSStringEncoding*) availableStringEncodings;
|
|
|
|
+ (NSString*) localizedNameOfStringEncoding: (NSStringEncoding)encoding;
|
|
|
|
- (void) getLineStart: (unsigned int *)startIndex
|
|
|
|
end: (unsigned int *)lineEndIndex
|
|
|
|
contentsEnd: (unsigned int *)contentsEndIndex
|
|
|
|
forRange: (NSRange)aRange;
|
|
|
|
- (NSRange) lineRangeForRange: (NSRange)aRange;
|
1999-08-25 14:47:19 +00:00
|
|
|
- (const char*) lossyCString;
|
2004-07-04 09:25:50 +00:00
|
|
|
- (NSString*) stringByAddingPercentEscapesUsingEncoding: (NSStringEncoding)e;
|
2002-08-30 08:36:20 +00:00
|
|
|
- (NSString*) stringByPaddingToLength: (unsigned int)newLength
|
|
|
|
withString: (NSString*)padString
|
|
|
|
startingAtIndex: (unsigned int)padIndex;
|
2004-07-04 09:25:50 +00:00
|
|
|
- (NSString*) stringByReplacingPercentEscapesUsingEncoding: (NSStringEncoding)e;
|
2002-08-30 08:36:20 +00:00
|
|
|
- (NSString*) stringByTrimmingCharactersInSet: (NSCharacterSet*)aSet;
|
2000-09-12 23:08:40 +00:00
|
|
|
- (const char *)UTF8String;
|
1996-11-24 21:00:28 +00:00
|
|
|
#endif
|
|
|
|
|
1996-11-24 18:30:48 +00:00
|
|
|
#ifndef NO_GNUSTEP
|
2002-03-13 13:46:12 +00:00
|
|
|
+ (Class) constantStringClass;
|
1998-10-21 11:56:58 +00:00
|
|
|
- (BOOL) boolValue;
|
1996-11-24 18:30:48 +00:00
|
|
|
#endif /* NO_GNUSTEP */
|
|
|
|
|
1995-04-03 01:42:02 +00:00
|
|
|
@end
|
|
|
|
|
2002-03-13 13:46:12 +00:00
|
|
|
@interface NSMutableString : NSString
|
1995-04-03 01:42:02 +00:00
|
|
|
|
|
|
|
// Creating Temporary Strings
|
1999-11-26 20:06:17 +00:00
|
|
|
+ (id) string;
|
2002-03-13 13:46:12 +00:00
|
|
|
+ (id) stringWithCharacters: (const unichar*)characters
|
1999-11-26 20:06:17 +00:00
|
|
|
length: (unsigned int)length;
|
|
|
|
+ (id) stringWithCString: (const char*)byteString
|
|
|
|
length: (unsigned int)length;
|
2005-05-08 07:08:28 +00:00
|
|
|
+ (id) stringWithCString: (const char*)byteString;
|
1999-11-26 20:06:17 +00:00
|
|
|
+ (id) stringWithFormat: (NSString*)format,...;
|
2002-03-13 13:46:12 +00:00
|
|
|
+ (id) stringWithContentsOfFile: (NSString*)path;
|
|
|
|
+ (NSMutableString*) stringWithCapacity: (unsigned int)capacity;
|
1995-04-03 01:42:02 +00:00
|
|
|
|
|
|
|
// Initializing Newly Allocated Strings
|
2002-03-13 13:46:12 +00:00
|
|
|
- (id) initWithCapacity: (unsigned int)capacity;
|
1995-04-03 01:42:02 +00:00
|
|
|
|
|
|
|
// Modify A String
|
|
|
|
- (void) appendFormat: (NSString*)format, ...;
|
1996-11-24 21:00:28 +00:00
|
|
|
- (void) appendString: (NSString*)aString;
|
1995-04-03 01:42:02 +00:00
|
|
|
- (void) deleteCharactersInRange: (NSRange)range;
|
2002-03-13 13:46:12 +00:00
|
|
|
- (void) insertString: (NSString*)aString atIndex: (unsigned int)loc;
|
1995-04-03 01:42:02 +00:00
|
|
|
- (void) replaceCharactersInRange: (NSRange)range
|
1999-11-26 19:43:43 +00:00
|
|
|
withString: (NSString*)aString;
|
2003-01-26 19:50:42 +00:00
|
|
|
- (unsigned int) replaceOccurrencesOfString: (NSString*)replace
|
|
|
|
withString: (NSString*)by
|
|
|
|
options: (unsigned int)opts
|
|
|
|
range: (NSRange)searchRange;
|
1995-04-03 01:42:02 +00:00
|
|
|
- (void) setString: (NSString*)aString;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2002-03-13 09:58:43 +00:00
|
|
|
/**
|
|
|
|
* <p>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 -</p>
|
|
|
|
* <list>
|
|
|
|
* <item>a pointer to the class (this is the sole ivar of NSObject)</item>
|
|
|
|
* <item>a pointer to the 8-bit data</item>
|
|
|
|
* <item>the length of the string</item>
|
|
|
|
* </list>
|
|
|
|
* <p>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
|
2004-06-22 22:27:39 +00:00
|
|
|
* preprocessor is used to change all occurences of NXConstantString
|
2002-03-13 09:58:43 +00:00
|
|
|
* in the source code to NSConstantString).</p>
|
|
|
|
* <p>Since GNUstep will generally use the GNUstep extension to the
|
2004-06-22 22:27:39 +00:00
|
|
|
* compiler, you should never refer to the constant string class by
|
2002-03-13 09:58:43 +00:00
|
|
|
* name, but should use the [NSString+constantStringClass] method to
|
|
|
|
* get the actual class being used for constant strings.</p>
|
|
|
|
* What follows is a dummy declaration of the class to keep the compiler
|
|
|
|
* happy.
|
1999-08-25 14:47:19 +00:00
|
|
|
*/
|
2000-10-09 04:41:18 +00:00
|
|
|
@interface NXConstantString : NSString
|
|
|
|
{
|
2002-03-13 09:58:43 +00:00
|
|
|
const char * const nxcsptr;
|
|
|
|
const unsigned int nxcslen;
|
2000-10-09 04:41:18 +00:00
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
2002-03-12 15:25:37 +00:00
|
|
|
#ifdef NeXT_RUNTIME
|
2004-07-29 15:30:47 +00:00
|
|
|
/** For internal use with NeXT runtime;
|
|
|
|
needed, until Apple Radar 2870817 is fixed. */
|
2002-01-03 20:39:12 +00:00
|
|
|
extern struct objc_class _NSConstantStringClassReference;
|
|
|
|
#endif
|
1995-03-18 17:15:15 +00:00
|
|
|
|
1999-02-13 00:50:41 +00:00
|
|
|
#ifndef NO_GNUSTEP
|
2000-11-03 14:25:09 +00:00
|
|
|
|
2003-01-26 19:38:42 +00:00
|
|
|
@interface NSMutableString (GNUstep)
|
2002-02-06 13:44:03 +00:00
|
|
|
- (NSString*) immutableProxy;
|
1999-02-13 00:50:41 +00:00
|
|
|
@end
|
2003-04-17 06:20:17 +00:00
|
|
|
|
2004-06-22 22:27:39 +00:00
|
|
|
/**
|
|
|
|
* Provides some additional (non-standard) utility methods.
|
|
|
|
*/
|
2003-04-17 06:20:17 +00:00
|
|
|
@interface NSString (GSCategories)
|
2004-06-22 22:27:39 +00:00
|
|
|
/**
|
|
|
|
* Alternate way to invoke <code>stringWithFormat</code> if you have or wish
|
|
|
|
* to build an explicit <code>va_list</code> structure.
|
|
|
|
*/
|
2003-11-10 15:34:52 +00:00
|
|
|
+ (id) stringWithFormat: (NSString*)format
|
|
|
|
arguments: (va_list)argList;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a string formed by removing the prefix string from the
|
|
|
|
* receiver. Raises an exception if the prefix is not present.
|
|
|
|
*/
|
2003-04-17 06:20:17 +00:00
|
|
|
- (NSString*) stringByDeletingPrefix: (NSString*)prefix;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a string formed by removing the suffix string from the
|
|
|
|
* receiver. Raises an exception if the suffix is not present.
|
|
|
|
*/
|
2003-04-17 06:20:17 +00:00
|
|
|
- (NSString*) stringByDeletingSuffix: (NSString*)suffix;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a string formed by removing leading white space from the
|
|
|
|
* receiver.
|
|
|
|
*/
|
2003-04-17 06:20:17 +00:00
|
|
|
- (NSString*) stringByTrimmingLeadSpaces;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a string formed by removing trailing white space from the
|
|
|
|
* receiver.
|
|
|
|
*/
|
2003-04-17 06:20:17 +00:00
|
|
|
- (NSString*) stringByTrimmingTailSpaces;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a string formed by removing both leading and trailing
|
|
|
|
* white space from the receiver.
|
|
|
|
*/
|
2003-04-17 06:20:17 +00:00
|
|
|
- (NSString*) stringByTrimmingSpaces;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a string in which any (and all) occurrences of
|
|
|
|
* replace in the receiver have been replaced with by.
|
|
|
|
* Returns the receiver if replace
|
|
|
|
* does not occur within the receiver. NB. an empty string is
|
|
|
|
* not considered to exist within the receiver.
|
|
|
|
*/
|
2003-04-17 06:20:17 +00:00
|
|
|
- (NSString*) stringByReplacingString: (NSString*)replace
|
|
|
|
withString: (NSString*)by;
|
|
|
|
@end
|
|
|
|
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GNUstep specific (non-standard) additions to the NSMutableString class.
|
|
|
|
*/
|
2003-04-17 06:20:17 +00:00
|
|
|
@interface NSMutableString (GSCategories)
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes the specified suffix from the string. Raises an exception
|
|
|
|
* if the suffix is not present.
|
|
|
|
*/
|
2003-04-17 06:20:17 +00:00
|
|
|
- (void) deleteSuffix: (NSString*)suffix;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes the specified prefix from the string. Raises an exception
|
|
|
|
* if the prefix is not present.
|
|
|
|
*/
|
2003-04-17 06:20:17 +00:00
|
|
|
- (void) deletePrefix: (NSString*)prefix;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Replaces all occurrances of the string replace with the string by
|
|
|
|
* in the receiver.<br />
|
|
|
|
* Has no effect if replace does not occur within the
|
|
|
|
* receiver. NB. an empty string is not considered to exist within
|
|
|
|
* the receiver.<br />
|
|
|
|
* Calls - replaceOccurrencesOfString:withString:options:range: passing
|
|
|
|
* zero for the options and a range from 0 with the length of the receiver.
|
|
|
|
*/
|
2003-04-17 06:20:17 +00:00
|
|
|
- (void) replaceString: (NSString*)replace
|
|
|
|
withString: (NSString*)by;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all leading white space from the receiver.
|
|
|
|
*/
|
2003-04-17 06:20:17 +00:00
|
|
|
- (void) trimLeadSpaces;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all trailing white space from the receiver.
|
|
|
|
*/
|
2003-04-17 06:20:17 +00:00
|
|
|
- (void) trimTailSpaces;
|
2004-06-22 22:27:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes all leading or trailing white space from the receiver.
|
|
|
|
*/
|
2003-04-17 06:20:17 +00:00
|
|
|
- (void) trimSpaces;
|
|
|
|
@end
|
|
|
|
|
1999-02-13 00:50:41 +00:00
|
|
|
#endif /* NO_GNUSTEP */
|
|
|
|
|
1996-04-17 19:36:35 +00:00
|
|
|
#endif /* __NSString_h_GNUSTEP_BASE_INCLUDE */
|