Class: NSMutableString
Overview
The NSMutableString class declares the programmatic interface to an object that manages a mutable string—that is, a string whose contents can be edited—that conceptually represents an array of Unicode characters. To construct and manage an immutable string—or a string that cannot be changed after it has been created—use an object of the NSString class.
Direct Known Subclasses
Class Method Summary (collapse)
-
+ stringWithCapacity:
Returns an empty NSMutableString object with initial storage for a given number of characters.
Instance Method Summary (collapse)
-
- appendFormat:
Adds a constructed string to the receiver.
-
- appendString:
Adds to the end of the receiver the characters of a given string.
-
- deleteCharactersInRange:
Removes from the receiver the characters in a given range.
-
- initWithCapacity:
Returns an NSMutableString object initialized with initial storage for a given number of characters, The number of characters indicated by capacity is simply a hint to increase the efficiency of data storage.
-
- insertString:atIndex:
Inserts into the receiver the characters of a given string at a given location.
-
- replaceCharactersInRange:withString:
Replaces the characters from aRange with those in aString.
-
- replaceOccurrencesOfString:withString:options:range:
Replaces all occurrences of a given string in a given range with another given string, returning the number of replacements.
-
- setString:
Replaces the characters of the receiver with those in a given string.
Methods inherited from NSString
availableStringEncodings, #boolValue, #cStringUsingEncoding:, #canBeConvertedToEncoding:, #capitalizedString, #capitalizedStringWithLocale:, #caseInsensitiveCompare:, #characterAtIndex:, #commonPrefixWithString:options:, #compare:, #compare:options:, #compare:options:range:, #compare:options:range:locale:, #completePathIntoString:caseSensitive:matchesIntoArray:filterTypes:, #componentsSeparatedByCharactersInSet:, #componentsSeparatedByString:, #dataUsingEncoding:, #dataUsingEncoding:allowLossyConversion:, #decomposedStringWithCanonicalMapping, #decomposedStringWithCompatibilityMapping, defaultCStringEncoding, #description, #doubleValue, #encode, #encode!, #enumerateLinesUsingBlock:, #enumerateLinguisticTagsInRange:scheme:options:orthography:usingBlock:, #enumerateSubstringsInRange:options:usingBlock:, #fastestEncoding, #fileSystemRepresentation, #floatValue, #getBytes:maxLength:usedLength:encoding:options:range:remainingRange:, #getCString:maxLength:encoding:, #getCharacters:range:, #getFileSystemRepresentation:maxLength:, #getLineStart:end:contentsEnd:forRange:, localizedNameOfStringEncoding:, localizedStringWithFormat:, pathWithComponents:, string, stringWithCString:encoding:, stringWithCharacters:length:, stringWithContentsOfFile:encoding:error:, stringWithContentsOfFile:usedEncoding:error:, stringWithContentsOfURL:encoding:error:, stringWithContentsOfURL:usedEncoding:error:, stringWithFormat:, stringWithString:, stringWithUTF8String:
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Class Method Details
+ (Object) stringWithCapacity(capacity)
Returns an empty NSMutableString object with initial storage for a given number of characters. The number of characters indicated by capacity is simply a hint to increase the efficiency of data storage. The value does not limit the length of the string.
Instance Method Details
- (Object) appendFormat(format, ...)
Adds a constructed string to the receiver.
- (Object) appendString(aString)
Adds to the end of the receiver the characters of a given string.
- (Object) deleteCharactersInRange(aRange)
Removes from the receiver the characters in a given range. This method treats the length of the string as a valid range value that returns an empty string.
- (Object) initWithCapacity(capacity)
Returns an NSMutableString object initialized with initial storage for a given number of characters, The number of characters indicated by capacity is simply a hint to increase the efficiency of data storage. The value does not limit the length of the string.
- (Object) insertString(aString, atIndex:anIndex)
Inserts into the receiver the characters of a given string at a given location. The new characters begin at anIndex and the existing characters from anIndex to the end are shifted by the length of aString.This method treats the length of the string as a valid index value that returns an empty string.
- (Object) replaceCharactersInRange(aRange, withString:aString)
Replaces the characters from aRange with those in aString. This method treats the length of the string as a valid range value that returns an empty string.
- (Integer) replaceOccurrencesOfString(target, withString:replacement, options:opts, range:searchRange)
Replaces all occurrences of a given string in a given range with another given string, returning the number of replacements. This method treats the length of the string as a valid range value that returns an empty string.
- (Object) setString(aString)
Replaces the characters of the receiver with those in a given string.