NSMutableString Class

Definition

The Foundation framework mutable string class.

[Foundation.Register("NSMutableString", true)]
public class NSMutableString : Foundation.NSString, IDisposable
type NSMutableString = class
    inherit NSString
    interface INSCoding
    interface INativeObject
    interface IDisposable
Inheritance
NSMutableString
Attributes
Implements

Remarks

This is a mapping to the Objective-C NSString class. Generally, in .NET languages you use the native T:System.Text.StringBuilder type in your code.

This class is exposed purely to support binding some Objective-C libraries that expose APIs that use this type. But it is in general discouraged as part of general API design (it is also in general not exposed by well designed Objective-C libraries).

Constructors

NSMutableString()

Default constructor, initializes a new instance of this class.

NSMutableString(IntPtr)

A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

NSMutableString(nint)

Creates a new mutable string with the specified initial capacity.

NSMutableString(NSCoder)

A constructor that initializes the object from the data stored in the unarchiver object.

NSMutableString(NSObjectFlag)

Constructor to call on derived classes to skip initialization and merely allocate the object.

Properties

Class (Inherited from NSObject)
ClassHandle

The handle for this class.

DebugDescription

A developer-meaningful description of this object.

(Inherited from NSObject)
Description

Description of the object, the Objective-C version of ToString.

(Inherited from NSObject)
Handle

Handle (pointer) to the unmanaged object representation.

(Inherited from NSObject)
IsAbsolutePath

Whether this is an absolute path.

(Inherited from NSString)
IsDirectBinding (Inherited from NSObject)
IsProxy (Inherited from NSObject)
Item[nint] (Inherited from NSString)
LastPathComponent

The last path component of this string.

(Inherited from NSString)
Length

The number of Unicode characters in this string.

(Inherited from NSString)
LocalizedCapitalizedString (Inherited from NSString)
LocalizedLowercaseString (Inherited from NSString)
LocalizedUppercaseString (Inherited from NSString)
PathComponents

An array of strings containing, in order, each path component of this string.

(Inherited from NSString)
PathExtension

Returns this string's path extension, if it has one.

(Inherited from NSString)
RetainCount

Returns the current Objective-C retain count for the object.

(Inherited from NSObject)
Self (Inherited from NSObject)
Superclass (Inherited from NSObject)
SuperHandle

Handle used to represent the methods in the base class for this NSObject.

(Inherited from NSObject)
WritableTypeIdentifiersForItemProvider (Inherited from NSString)
Zone (Inherited from NSObject)

Methods

AbbreviateTildeInPath()

Converts a spath to a home-directory-relative path by substituting a tilde for the relevant portion of the path.

(Inherited from NSString)
AddObserver(NSObject, NSString, NSKeyValueObservingOptions, IntPtr)

Registers an object for being observed externally (using NSString keyPath).   Observed changes are dispatched to the observer’s object ObserveValue(NSString, NSObject, NSDictionary, IntPtr) method.

(Inherited from NSObject)
AddObserver(NSObject, String, NSKeyValueObservingOptions, IntPtr)

Registers an object for being observed externally (using string keyPath).   Observed changes are dispatched to the observer’s object ObserveValue(NSString, NSObject, NSDictionary, IntPtr) method.

(Inherited from NSObject)
AddObserver(NSString, NSKeyValueObservingOptions, Action<NSObservedChange>)

Registers an object for being observed externally using an arbitrary method.

(Inherited from NSObject)
AddObserver(String, NSKeyValueObservingOptions, Action<NSObservedChange>)

Registers an object for being observed externally using an arbitrary method.

(Inherited from NSObject)
Append(NSString)

Appends an NSString to this mutable string.

AppendPathComponent(NSString)

Appends the specified str in a manner that results in a path.

(Inherited from NSString)
AppendPathExtension(NSString)

Creates a path by appending a path extension separator and then the specified str as a file extension.

(Inherited from NSString)
AppendPaths(String[])

Returns the array of strings created by appending this NSString to each of the specified input paths.

(Inherited from NSString)
ApplyTransform(NSString, Boolean, NSRange, NSRange)
ApplyTransform(NSStringTransform, Boolean, NSRange, NSRange)
AwakeFromNib()

Called after the object has been loaded from the nib file. Overriders must call base.AwakeFromNib().

(Inherited from NSObject)
BeginInvokeOnMainThread(Action) (Inherited from NSObject)
BeginInvokeOnMainThread(Selector, NSObject)

Invokes asynchrously the specified code on the main UI thread.

(Inherited from NSObject)
Bind(NSString, NSObject, String, NSDictionary) (Inherited from NSObject)
Bind(String, NSObject, String, NSDictionary)
Obsolete.
(Inherited from NSObject)
BindingInfo(String)
Obsolete.
(Inherited from NSObject)
BindingOptionDescriptions(String)
Obsolete.
(Inherited from NSObject)
BindingValueClass(String)
Obsolete.
(Inherited from NSObject)
BoundingRectWithSize(CGSize, NSStringDrawingOptions, NSDictionary) (Inherited from NSString)
Capitalize(NSLocale)

Capitalizes a string using the rules of the specified locale.

(Inherited from NSString)
CommitEditing() (Inherited from NSObject)
CommitEditing(NSObject, Selector, IntPtr) (Inherited from NSObject)
CommonPrefix(NSString, NSStringCompareOptions) (Inherited from NSString)
Compare(NSString)

Lexically compares this to the specified string.

(Inherited from NSString)
Compare(NSString, NSStringCompareOptions) (Inherited from NSString)
Compare(NSString, NSStringCompareOptions, NSRange) (Inherited from NSString)
Compare(NSString, NSStringCompareOptions, NSRange, NSLocale) (Inherited from NSString)
ConformsToProtocol(IntPtr)

Invoked to determine if this object implements the specified protocol.

(Inherited from NSObject)
Contains(NSString) (Inherited from NSString)
Copy()

Performs a copy of the underlying Objective-C object.

(Inherited from NSObject)
Copy(NSZone)

Performs a copy of the underlying Objective-C object.

(Inherited from NSString)
DangerousAutorelease() (Inherited from NSObject)
DangerousRelease() (Inherited from NSObject)
DangerousRetain() (Inherited from NSObject)
DeleteCharacters(NSRange)

Removes a range of characters from the string.

DeleteLastPathComponent()

Returns a new string by deleting the last path component of this string.

(Inherited from NSString)
DeletePathExtension()

Returns a new string by deleting the path extension from this string.

(Inherited from NSString)
DidChange(NSKeyValueChange, NSIndexSet, NSString)

Indicates a change occurred to the indexes for a to-many relationship.

(Inherited from NSObject)
DidChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
DidChangeValue(String)

Indicates that a change occurred on the specified key.

(Inherited from NSObject)
Dispose()

Releases the resources used by the NSObject object.

(Inherited from NSObject)
Dispose(Boolean)

Releases the resources used by the NSObject object.

(Inherited from NSObject)
DoesNotRecognizeSelector(Selector)

Indicates that this object does not recognize the specified selector.

(Inherited from NSObject)
DrawString(CGPoint, NSDictionary) (Inherited from NSString)
DrawString(CGRect, NSDictionary) (Inherited from NSString)
DrawString(CGRect, NSStringDrawingOptions, NSDictionary) (Inherited from NSString)
Encode(NSStringEncoding, Boolean) (Inherited from NSString)
EncodeTo(NSCoder)

Encodes the state of the object on the provided encoder

Equals(NSObject) (Inherited from NSObject)
Equals(Object) (Inherited from NSString)
ExpandTildeInPath()

Returns a new string that expands a tilde in this string (indicating the user's home dir) into a full path.

(Inherited from NSString)
ExposedBindings() (Inherited from NSObject)
GetBindingInfo(NSString) (Inherited from NSObject)
GetBindingOptionDescriptions(NSString) (Inherited from NSObject)
GetBindingValueClass(NSString) (Inherited from NSObject)
GetDictionaryOfValuesFromKeys(NSString[])

Retrieves the values of the specified keys.

(Inherited from NSObject)
GetHashCode()

Generates a hash code for the current instance.

(Inherited from NSString)
GetItemProviderVisibilityForTypeIdentifier(String) (Inherited from NSString)
GetLineStart(nuint, nuint, nuint, NSRange) (Inherited from NSString)
GetMethodForSelector(Selector) (Inherited from NSObject)
GetNativeField(String)
Obsolete.
(Inherited from NSObject)
GetNativeHash() (Inherited from NSObject)
GetParagraphPositions(nuint, nuint, nuint, NSRange) (Inherited from NSString)
GetParagraphRange(NSRange) (Inherited from NSString)
GetPasteboardPropertyListForType(String) (Inherited from NSString)
GetVariantFittingPresentationWidth(nint) (Inherited from NSString)
GetWritableTypesForPasteboard(NSPasteboard) (Inherited from NSString)
GetWritingOptionsForType(String, NSPasteboard) (Inherited from NSString)
HasPrefix(NSString) (Inherited from NSString)
HasSuffix(NSString) (Inherited from NSString)
Init() (Inherited from NSObject)
InitializeHandle(IntPtr) (Inherited from NSObject)
InitializeHandle(IntPtr, String) (Inherited from NSObject)
InitWithPasteboardPropertyList(NSObject, String)
Obsolete.
(Inherited from NSString)
Insert(NSString, nint)

Inserts a string into the mutable string.

Invoke(Action, Double) (Inherited from NSObject)
Invoke(Action, TimeSpan) (Inherited from NSObject)
InvokeOnMainThread(Action) (Inherited from NSObject)
InvokeOnMainThread(Selector, NSObject)

Invokes synchrously the specified code on the main UI thread.

(Inherited from NSObject)
IsEqual(NSObject) (Inherited from NSObject)
IsEqualTo(IntPtr) (Inherited from NSString)
IsKindOfClass(Class) (Inherited from NSObject)
IsMemberOfClass(Class) (Inherited from NSObject)
LineRangeForRange(NSRange) (Inherited from NSString)
LoadData(String, Action<NSData,NSError>)

Implement this method to customize the loading of data by an NSItemProvider.

(Inherited from NSString)
LoadDataAsync(String) (Inherited from NSString)
LoadDataAsync(String, NSProgress) (Inherited from NSString)
LocalizedCaseInsensitiveContains(NSString) (Inherited from NSString)
LocalizedStandardContainsString(NSString) (Inherited from NSString)
LocalizedStandardRangeOfString(NSString) (Inherited from NSString)
MarkDirty()

Promotes a regular peer object (IsDirectBinding is true) into a toggleref object.

(Inherited from NSObject)
MutableCopy()

Creates a mutable copy of the specified NSObject.

(Inherited from NSObject)
MutableCopy(NSZone)

Performs a copy of the underlying Objective-C object.

(Inherited from NSString)
ObjectDidEndEditing(NSObject) (Inherited from NSObject)
ObserveValue(NSString, NSObject, NSDictionary, IntPtr)

Indicates that the value at the specified keyPath relative to this object has changed.

(Inherited from NSObject)
PerformSelector(Selector) (Inherited from NSObject)
PerformSelector(Selector, NSObject) (Inherited from NSObject)
PerformSelector(Selector, NSObject, Double)

Invokes the selector on the current instance and if the obj is not null, it passes this as its single parameter.

(Inherited from NSObject)
PerformSelector(Selector, NSObject, Double, NSString[]) (Inherited from NSObject)
PerformSelector(Selector, NSObject, NSObject) (Inherited from NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean) (Inherited from NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean, NSString[]) (Inherited from NSObject)
PrepareForInterfaceBuilder() (Inherited from NSObject)
RemoveObserver(NSObject, NSString)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath.

(Inherited from NSObject)
RemoveObserver(NSObject, NSString, IntPtr)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath and context.

(Inherited from NSObject)
RemoveObserver(NSObject, String)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath.

(Inherited from NSObject)
RemoveObserver(NSObject, String, IntPtr)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath and context.

(Inherited from NSObject)
Replace(NSRange, NSString)

Returns a new string that substitutes the replacement string into this string, at the specified range.

(Inherited from NSString)
ReplaceCharactersInRange(NSRange, NSString)
ReplaceOcurrences(NSString, NSString, NSStringCompareOptions, NSRange)

Replaces the contents of the mutable string matching a pattern with another.

ResolveSymlinksInPath()

Resolves all symbolic links in this and returns the standardized path result.

(Inherited from NSString)
RespondsToSelector(Selector)

Whether this object recognizes the specified selector.

(Inherited from NSObject)
SeparateComponents(NSCharacterSet) (Inherited from NSString)
SeparateComponents(NSString) (Inherited from NSString)
SetNativeField(String, NSObject)
Obsolete.
(Inherited from NSObject)
SetNilValueForKey(NSString)

Sets the value of the specified key to null.

(Inherited from NSObject)
SetString(NSString)

Sets the contents of this mutable string.

SetValueForKey(NSObject, NSString)

Sets the value of the property specified by the key to the specified value.

(Inherited from NSObject)
SetValueForKeyPath(IntPtr, NSString)

A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

(Inherited from NSObject)
SetValueForKeyPath(NSObject, NSString)

Sets the value of a property that can be reached using a keypath.

(Inherited from NSObject)
SetValueForUndefinedKey(NSObject, NSString)

Indicates an attempt to write a value to an undefined key. If not overridden, raises an NSUndefinedKeyException.

(Inherited from NSObject)
SetValuesForKeysWithDictionary(NSDictionary)

Sets the values of this NSObject to those in the specified dictionary.

(Inherited from NSObject)
StandarizePath()

Standardizes this string into a path by, for instance, removing "/./" and similar constructs.

(Inherited from NSString)
StringSize(NSDictionary) (Inherited from NSString)
ToLower(NSLocale)

Returns a new string that is the lowercase version of this string, according to the rules of the specified locale.

(Inherited from NSString)
ToString()

Returns a string representation of the value of the current instance.

(Inherited from NSString)
ToUpper(NSLocale)

Returns a new string that is the uppercase version of this string, according to the rules of the specified locale.

(Inherited from NSString)
TransliterateString(NSString, Boolean) (Inherited from NSString)
TransliterateString(NSStringTransform, Boolean) (Inherited from NSString)
Unbind(NSString) (Inherited from NSObject)
Unbind(String)
Obsolete.
(Inherited from NSObject)
ValueForKey(NSString)

Returns the value of the property associated with the specified key.

(Inherited from NSObject)
ValueForKeyPath(NSString)

Returns the value of a property that can be reached using a keypath.

(Inherited from NSObject)
ValueForUndefinedKey(NSString)

Indicates an attempt to read a value of an undefined key. If not overridden, raises an NSUndefinedKeyException.

(Inherited from NSObject)
WillChange(NSKeyValueChange, NSIndexSet, NSString)

Indicates that the values of the specified indices in the specified key are about to change.

(Inherited from NSObject)
WillChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
WillChangeValue(String)

Indicates that the value of the specified key is about to change.

(Inherited from NSObject)

Extension Methods

DrawString(NSString, CGRect, NSStringDrawingOptions, NSStringAttributes, NSStringDrawingContext)
GetBoundingRect(NSString, CGSize, NSStringDrawingOptions, NSStringAttributes, NSStringDrawingContext)
WeakDrawString(NSString, CGRect, NSStringDrawingOptions, NSDictionary, NSStringDrawingContext)
WeakGetBoundingRect(NSString, CGSize, NSStringDrawingOptions, NSDictionary, NSStringDrawingContext)
ObjectDidBeginEditing(NSObject, INSEditor)
ObjectDidEndEditing(NSObject, INSEditor)
GetValidModes(NSObject, NSFontPanel)
ValidateToolbarItem(NSObject, NSToolbarItem)
GetPasteboardPropertyListForType(INSPasteboardWriting, String)
GetWritableTypesForPasteboard(INSPasteboardWriting, NSPasteboard)
GetWritingOptionsForType(INSPasteboardWriting, String, NSPasteboard)
DrawAtPoint(NSString, CGPoint, NSStringAttributes)
DrawAtPoint(NSString, CGPoint, NSDictionary)
DrawInRect(NSString, CGRect, NSStringAttributes)
DrawInRect(NSString, CGRect, NSDictionary)
StringSize(NSString, NSStringAttributes)
StringSize(NSString, NSDictionary)
GetItemProviderVisibilityForTypeIdentifier(INSItemProviderWriting, String)
GetWritableTypeIdentifiersForItemProvider(INSItemProviderWriting)
LoadDataAsync(INSItemProviderWriting, String)
LoadDataAsync(INSItemProviderWriting, String, NSProgress)
EnumerateLinguisticTags(NSString, NSRange, NSLinguisticTagScheme, NSLinguisticTaggerOptions, NSOrthography, NSEnumerateLinguisticTagsEnumerator)
EnumerateLinguisticTags(NSString, NSRange, NSString, NSLinguisticTaggerOptions, NSOrthography, NSEnumerateLinguisticTagsEnumerator)
GetLinguisticTags(NSString, NSRange, NSLinguisticTagScheme, NSLinguisticTaggerOptions, NSOrthography, NSValue[])
GetLinguisticTags(NSString, NSRange, NSString, NSLinguisticTaggerOptions, NSOrthography, NSValue[])
GetDebugDescription(INSObjectProtocol)
CreateStringByAddingPercentEncoding(NSString, NSCharacterSet)
CreateStringByAddingPercentEscapes(NSString, NSStringEncoding)
CreateStringByRemovingPercentEncoding(NSString)
CreateStringByReplacingPercentEscapes(NSString, NSStringEncoding)
AcceptsPreviewPanelControl(NSObject, QLPreviewPanel)
BeginPreviewPanelControl(NSObject, QLPreviewPanel)
EndPreviewPanelControl(NSObject, QLPreviewPanel)
DrawString(NSString, CGRect, NSStringDrawingOptions, UIStringAttributes, NSStringDrawingContext)
GetBoundingRect(NSString, CGSize, NSStringDrawingOptions, UIStringAttributes, NSStringDrawingContext)
WeakDrawString(NSString, CGRect, NSStringDrawingOptions, NSDictionary, NSStringDrawingContext)
WeakGetBoundingRect(NSString, CGSize, NSStringDrawingOptions, NSDictionary, NSStringDrawingContext)
GetAccessibilityCustomRotors(NSObject)

Gets the array of UIAccessibilityCustomRotor objects appropriate for this object.

SetAccessibilityCustomRotors(NSObject, UIAccessibilityCustomRotor[])

Sets the array of UIAccessibilityCustomRotor objects appropriate for this object.

DrawString(NSString, CGPoint, UIStringAttributes)
DrawString(NSString, CGRect, UIStringAttributes)
GetSizeUsingAttributes(NSString, UIStringAttributes)

The SizeF of the string, if rendered with the specified attributes.

WeakDrawString(NSString, CGPoint, NSDictionary)
WeakDrawString(NSString, CGRect, NSDictionary)
WeakGetSizeUsingAttributes(NSString, NSDictionary)

Returns the size of the rendered string.

DrawString(NSString, CGPoint, nfloat, UIFont, nfloat, nfloat, UILineBreakMode, UIBaselineAdjustment)

M:Foundation.NSString.DrawString(CoreGraphics.CGRect, UIKit.UIStringAttributes)

DrawString(NSString, CGPoint, nfloat, UIFont, nfloat, UILineBreakMode, UIBaselineAdjustment)

M:Foundation.NSString.DrawString(CoreGraphics.CGRect, UIKit.UIStringAttributes)

DrawString(NSString, CGPoint, nfloat, UIFont, UILineBreakMode)

M:Foundation.NSString.DrawString(CoreGraphics.CGRect, UIKit.UIStringAttributes)

DrawString(NSString, CGPoint, UIFont)

Developers should not use this deprecated method. Developers should use 'NSString.DrawString (CGPoint, UIStringAttributes)' instead.

DrawString(NSString, CGRect, UIFont)

M:Foundation.NSString.DrawString(CoreGraphics.CGRect, UIKit.UIStringAttributes)

DrawString(NSString, CGRect, UIFont, UILineBreakMode)

M:Foundation.NSString.DrawString(CoreGraphics.CGRect, UIKit.UIStringAttributes)

DrawString(NSString, CGRect, UIFont, UILineBreakMode, UITextAlignment)

M:Foundation.NSString.DrawString(CoreGraphics.CGRect, UIKit.UIStringAttributes)

StringSize(NSString, UIFont)

Developers should use GetSizeUsingAttributes(NSString, UIStringAttributes) rather than this deprecated method.

StringSize(NSString, UIFont, CGSize)

The calculated size of the string if rendered with the font or constrainedToSize, whichever is smaller.

StringSize(NSString, UIFont, CGSize, UILineBreakMode)

Gets the CGSize necessary to display this NSString.

StringSize(NSString, UIFont, nfloat, nfloat, nfloat, UILineBreakMode)

Gets the CGSize necessary to display this NSString.

StringSize(NSString, UIFont, nfloat, UILineBreakMode)

Gets the CGSize necessary to display this NSString.

Applies to

See also