NSString Class Reference

List of all members.

Public Member Functions

(NSString *) - stringByReplacingRange:with: [implementation]


Detailed Description

Definition at line 128 of file SDLMain.mm.


Member Function Documentation

- (NSString *) stringByReplacingRange: (NSRange)  aRange
with: (NSString *)  aString 
[implementation]

Definition at line 130 of file SDLMain.mm.

References buffer.

00132                                     :(NSRange)aRange with:(NSString *)aString
00133 {
00134     unsigned int bufferSize;
00135     unsigned int selfLen = [self length];
00136     unsigned int aStringLen = [aString length];
00137     unichar *buffer;
00138     NSRange localRange;
00139     NSString *result;
00140 
00141     bufferSize = selfLen + aStringLen - aRange.length;
00142     buffer = (unichar *) NSAllocateMemoryPages(bufferSize*sizeof(unichar));
00143     
00144     /* Get first part into buffer */
00145     localRange.location = 0;
00146     localRange.length = aRange.location;
00147     [self getCharacters:buffer range:localRange];
00148     
00149     /* Get middle part into buffer */
00150     localRange.location = 0;
00151     localRange.length = aStringLen;
00152     [aString getCharacters:(buffer+aRange.location) range:localRange];
00153      
00154     /* Get last part into buffer */
00155     localRange.location = aRange.location + aRange.length;
00156     localRange.length = selfLen - localRange.location;
00157     [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
00158     
00159     /* Build output string */
00160     result = [NSString stringWithCharacters:buffer length:bufferSize];
00161     NSDeallocateMemoryPages(buffer, bufferSize);
00162     


The documentation for this class was generated from the following file:
Generated on Sat Mar 15 23:50:57 2008 for Armagetron Advanced by  doxygen 1.5.4