Share via


NSString Class

Definition

[Foundation.Register("NSString", true)]
public class NSString : Foundation.NSObject, CloudKit.ICKRecordValue, Foundation.INSItemProviderReading, Foundation.INSItemProviderWriting, Foundation.INSMutableCopying, Foundation.INSSecureCoding, IComparable<Foundation.NSString>, IDisposable
[Foundation.Register("NSString", true)]
public class NSString : Foundation.NSObject, AppKit.INSPasteboardReading, AppKit.INSPasteboardWriting, CloudKit.ICKRecordValue, Foundation.INSItemProviderReading, Foundation.INSItemProviderWriting, Foundation.INSMutableCopying, Foundation.INSSecureCoding, IComparable<Foundation.NSString>, IDisposable
[<Foundation.Register("NSString", true)>]
type NSString = class
    inherit NSObject
    interface IComparable<NSString>
    interface INSCoding
    interface INativeObject
    interface IDisposable
    interface INSCopying
    interface INSItemProviderReading
    interface INSItemProviderWriting
    interface INSMutableCopying
    interface INSSecureCoding
    interface ICKRecordValue
[<Foundation.Register("NSString", true)>]
type NSString = class
    inherit NSObject
    interface IComparable<NSString>
    interface INSCoding
    interface INativeObject
    interface IDisposable
    interface INSCopying
    interface INSItemProviderReading
    interface INSItemProviderWriting
    interface INSMutableCopying
    interface INSSecureCoding
    interface INSPasteboardReading
    interface INSPasteboardWriting
    interface ICKRecordValue
Inheritance
NSString
Derived
Attributes
Implements

Constructors

NSString()

Creates a new NSString with default values.

NSString(NativeHandle)

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

NSString(NSCoder)

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

NSString(NSData, NSStringEncoding)
NSString(NSObjectFlag)

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

NSString(String, Int32, Int32)

Creates an NSString from a C# string.

NSString(String)

Creates an NSString from a C# string.

Fields

Empty

An NSString instance for an empty (zero-length) string.

Properties

AccessibilityAttributedUserInputLabels (Inherited from NSObject)
AccessibilityRespondsToUserInteraction (Inherited from NSObject)
AccessibilityTextualContext (Inherited from NSObject)
AccessibilityUserInputLabels (Inherited from NSObject)
Class (Inherited from NSObject)
ClassHandle

The Objective-C class handle for this class.

DebugDescription (Inherited from NSObject)
Description (Inherited from NSObject)
ExposedBindings (Inherited from NSObject)
Handle

Handle (pointer) to the unmanaged object representation.

(Inherited from NSObject)
IsAbsolutePath

Whether this is an absolute path.

IsDirectBinding (Inherited from NSObject)
IsProxy (Inherited from NSObject)
Item[IntPtr]
LastPathComponent
Length
LocalizedCapitalizedString
LocalizedLowercaseString
LocalizedUppercaseString
PathComponents
PathExtension
ReadableTypeIdentifiers
RetainCount (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)
WritableTypeIdentifiers
WritableTypeIdentifiersForItemProvider
Zone (Inherited from NSObject)

Methods

AbbreviateTildeInPath()
AddObserver(NSObject, NSString, NSKeyValueObservingOptions, IntPtr) (Inherited from NSObject)
AddObserver(NSObject, String, NSKeyValueObservingOptions, IntPtr) (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)
AppendPathComponent(NSString)
AppendPathExtension(NSString)
AppendPaths(String[])
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, NSBindingOptions) (Inherited from NSObject)
Bind(NSString, NSObject, String, NSDictionary) (Inherited from NSObject)
BoundingRectWithSize(CGSize, NSStringDrawingOptions, NSDictionary)
Capitalize(NSLocale)
CommitEditing() (Inherited from NSObject)
CommitEditing(NSObject, Selector, IntPtr) (Inherited from NSObject)
CommonPrefix(NSString, NSStringCompareOptions)
Compare(NSString, NSStringCompareOptions, NSRange, NSLocale)
Compare(NSString, NSStringCompareOptions, NSRange)
Compare(NSString, NSStringCompareOptions)
Compare(NSString)
CompareTo(NSString)
ConformsToProtocol(NativeHandle) (Inherited from NSObject)
Contains(NSString)
Copy() (Inherited from NSObject)
Copy(NSZone)

Performs a copy of the underlying Objective-C object.

CreateNative(String, Boolean)

Creates an Objective-C NSString from the C# string and returns a pointer to it.

CreateNative(String, Int32, Int32, Boolean)

Creates an Objective-C NSString from the C# string and returns a pointer to it.

CreateNative(String, Int32, Int32)

Creates an Objective-C NSString from the C# string and returns a pointer to it.

CreateNative(String)

Creates an Objective-C NSString from the C# string and returns a pointer to it.

DangerousAutorelease()

Calls the 'autorelease' selector on this object.

(Inherited from NSObject)
DangerousRelease()

Calls the 'release' selector on this object.

(Inherited from NSObject)
DangerousRetain()

Calls the 'retain' selector on this object.

(Inherited from NSObject)
DeleteLastPathComponent()
DeletePathExtension()
DetectStringEncoding(NSData, EncodingDetectionOptions, String, Boolean)
DetectStringEncoding(NSData, NSDictionary, String, Boolean)
DidChange(NSKeyValueChange, NSIndexSet, NSString) (Inherited from NSObject)
DidChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
DidChangeValue(String) (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) (Inherited from NSObject)
DrawString(CGPoint, NSDictionary)
DrawString(CGRect, NSDictionary)
DrawString(CGRect, NSStringDrawingOptions, NSDictionary)
Encode(NSStringEncoding, Boolean)
EncodeTo(NSCoder)

Encodes the state of the object using the provided encoder.

Equals(NSObject) (Inherited from NSObject)
Equals(NSString, NSString)

Compare two NSString instances.

Equals(Object)

Compare this NSString to another object.

ExpandTildeInPath()
FromData(NSData, NSStringEncoding)

Creates an NSString from an NSData source.

FromHandle(NativeHandle, Boolean)

Utility method that returns a string from a pointer that points to an Objective-C NSString or CFString object.

FromHandle(NativeHandle)

Utility method that returns a string from a pointer that points to an Objective-C NSString or CFString object.

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

Generates a hash code for the current instance.

GetItemProviderVisibilityForTypeIdentifier(String)
GetLineStart(UIntPtr, UIntPtr, UIntPtr, NSRange)
GetLocalizedUserNotificationString(NSString, NSObject[])
GetMethodForSelector(Selector) (Inherited from NSObject)
GetNativeHash() (Inherited from NSObject)
GetObject(NSData, String, NSError)
GetParagraphPositions(UIntPtr, UIntPtr, UIntPtr, NSRange)
GetParagraphRange(NSRange)
GetPasteboardPropertyListForType(String)
GetReadableTypesForPasteboard(NSPasteboard)
GetReadingOptionsForType(String, NSPasteboard)
GetVariantFittingPresentationWidth(IntPtr)
GetWritableTypesForPasteboard(NSPasteboard)
GetWritingOptionsForType(String, NSPasteboard)
HasPrefix(NSString)
HasSuffix(NSString)
Init() (Inherited from NSObject)
InitializeHandle(NativeHandle, String) (Inherited from NSObject)
InitializeHandle(NativeHandle) (Inherited from NSObject)
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)
IsKindOfClass(Class) (Inherited from NSObject)
IsMemberOfClass(Class) (Inherited from NSObject)
LineRangeForRange(NSRange)
LoadData(String, Action<NSData,NSError>)

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

LoadDataAsync(String, NSProgress)
LoadDataAsync(String)

Asynchronously loads data for the identified type from an item provider, returning a task that contains the data.

LocalizedCaseInsensitiveContains(NSString)
LocalizedFormat(NSString, NSObject[])

Format a localizable string with the specified arguments.

LocalizedFormat(NSString, Object[])

Format a localizable string with the specified arguments.

LocalizedFormat(String, Object[])

Format a localizable string with the specified arguments.

LocalizedStandardContainsString(NSString)
LocalizedStandardRangeOfString(NSString)
MarkDirty()

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

(Inherited from NSObject)
MutableCopy() (Inherited from NSObject)
MutableCopy(NSZone)
ObjectDidEndEditing(NSObject) (Inherited from NSObject)
ObserveValue(NSString, NSObject, NSDictionary, IntPtr) (Inherited from NSObject)
PathWithComponents(String[])
PerformSelector(Selector, NSObject, Double, NSString[]) (Inherited from NSObject)
PerformSelector(Selector, NSObject, Double) (Inherited from NSObject)
PerformSelector(Selector, NSObject, NSObject) (Inherited from NSObject)
PerformSelector(Selector, NSObject) (Inherited from NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean, NSString[]) (Inherited from NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean) (Inherited from NSObject)
PerformSelector(Selector) (Inherited from NSObject)
PrepareForInterfaceBuilder() (Inherited from NSObject)
ReleaseNative(NativeHandle)

Releases a native Objective-C string.

RemoveObserver(NSObject, NSString, IntPtr) (Inherited from NSObject)
RemoveObserver(NSObject, NSString) (Inherited from NSObject)
RemoveObserver(NSObject, String, IntPtr) (Inherited from NSObject)
RemoveObserver(NSObject, String) (Inherited from NSObject)
Replace(NSRange, NSString)
ResolveSymlinksInPath()
RespondsToSelector(Selector) (Inherited from NSObject)
SeparateComponents(NSCharacterSet)
SeparateComponents(NSString)
SetNilValueForKey(NSString) (Inherited from NSObject)
SetValueForKey(NSObject, NSString) (Inherited from NSObject)
SetValueForKeyPath(NativeHandle, NSString) (Inherited from NSObject)
SetValueForKeyPath(NSObject, NSString) (Inherited from NSObject)
SetValueForUndefinedKey(NSObject, NSString) (Inherited from NSObject)
SetValuesForKeysWithDictionary(NSDictionary) (Inherited from NSObject)
StandarizePath()
StringSize(NSDictionary)
ToLower(NSLocale)
ToString()

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

ToUpper(NSLocale)
TransliterateString(NSString, Boolean)
TransliterateString(NSStringTransform, Boolean)

Transliterate this string using the specified string transformation.

Unbind(NSString) (Inherited from NSObject)
ValueForKey(NSString) (Inherited from NSObject)
ValueForKeyPath(NSString) (Inherited from NSObject)
ValueForUndefinedKey(NSString) (Inherited from NSObject)
WillChange(NSKeyValueChange, NSIndexSet, NSString) (Inherited from NSObject)
WillChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
WillChangeValue(String) (Inherited from NSObject)

Operators

Equality(NSString, NSString)

Compare two NSString instances.

Explicit(String to NSString)

Converts the managed string to an NSString.

Implicit(NSString to String)

Converts the NSString to a managed string.

Inequality(NSString, NSString)

Compare two NSString instances.

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)
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)
BrowserAccessibilityDeleteTextAtCursor(NSObject, IntPtr)
BrowserAccessibilityInsertTextAtCursor(NSObject, String)
GetAccessibilityLineEndPositionFromCurrentSelection(NSObject)
GetAccessibilityLineRangeForPosition(NSObject, IntPtr)
GetAccessibilityLineStartPositionFromCurrentSelection(NSObject)
GetBrowserAccessibilityAttributedValue(NSObject, NSRange)
GetBrowserAccessibilityContainerType(NSObject)
GetBrowserAccessibilityCurrentStatus(NSObject)
GetBrowserAccessibilityHasDomFocus(NSObject)
GetBrowserAccessibilityIsRequired(NSObject)
GetBrowserAccessibilityPressedState(NSObject)
GetBrowserAccessibilityRoleDescription(NSObject)
GetBrowserAccessibilitySelectedTextRange(NSObject)
GetBrowserAccessibilitySortDirection(NSObject)
GetBrowserAccessibilityValue(NSObject, NSRange)
SetBrowserAccessibilityContainerType(NSObject, BEAccessibilityContainerType)
SetBrowserAccessibilityCurrentStatus(NSObject, String)
SetBrowserAccessibilityHasDomFocus(NSObject, Boolean)
SetBrowserAccessibilityIsRequired(NSObject, Boolean)
SetBrowserAccessibilityPressedState(NSObject, BEAccessibilityPressedState)
SetBrowserAccessibilityRoleDescription(NSObject, String)
SetBrowserAccessibilitySelectedTextRange(NSObject, NSRange)
SetBrowserAccessibilitySortDirection(NSObject, String)
ProvideImageData(NSObject, IntPtr, UIntPtr, UIntPtr, UIntPtr, UIntPtr, UIntPtr, NSObject)
ProvideImageToMTLTexture(NSObject, IMTLTexture, IMTLCommandBuffer, UIntPtr, UIntPtr, UIntPtr, UIntPtr, NSObject)
GetItemProviderVisibilityForTypeIdentifier(INSItemProviderWriting, String)
GetWritableTypeIdentifiersForItemProvider(INSItemProviderWriting)
LoadDataAsync(INSItemProviderWriting, String, NSProgress)
LoadDataAsync(INSItemProviderWriting, String)

Asynchronously loads data for the identified type from an item provider, returning a task that contains the data.

SetSharedObservers(NSObject, NSKeyValueSharedObserversSnapshot)
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)
GetHandle(INativeObject)
GetNonNullHandle(INativeObject, String)
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.

AccessibilityHitTest(NSObject, CGPoint, UIEvent)
GetAccessibilityNextTextNavigationElement(NSObject)
GetAccessibilityNextTextNavigationElementBlock(NSObject)
GetAccessibilityPreviousTextNavigationElement(NSObject)
GetAccessibilityPreviousTextNavigationElementBlock(NSObject)
SetAccessibilityNextTextNavigationElement(NSObject, NSObject)
SetAccessibilityNextTextNavigationElementBlock(NSObject, AXObjectReturnBlock)
SetAccessibilityPreviousTextNavigationElement(NSObject, NSObject)
SetAccessibilityPreviousTextNavigationElementBlock(NSObject, AXObjectReturnBlock)
GetAccessibilityTextInputResponder(NSObject)
GetAccessibilityTextInputResponderHandler(NSObject)
SetAccessibilityTextInputResponder(NSObject, IUITextInput)
SetAccessibilityTextInputResponderHandler(NSObject, UITextInputReturnHandler)
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)

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

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

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

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

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

DrawString(NSString, CGPoint, UIFont)

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

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

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

DrawString(NSString, CGRect, UIFont, UILineBreakMode)

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

DrawString(NSString, CGRect, UIFont)

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

StringSize(NSString, UIFont, CGSize, UILineBreakMode)

Gets the CGSize necessary to display this NSString.

StringSize(NSString, UIFont, CGSize)

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

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.

StringSize(NSString, UIFont)

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

AppendPathComponent(NSString, String, UTType)
AppendPathExtension(NSString, UTType)

Applies to