pub trait INSString: PNSObject {
Show 71 methods
// Provided methods
fn m_string() -> Self
where Self: Sized + FromId { ... }
fn m_init(&mut self) -> Self
where Self: Sized + FromId { ... }
fn m_init_with_bytes_length_encoding(
&mut self,
bytes: *const c_void,
len: UInt,
encoding: Encoding,
) -> Self
where Self: Sized + FromId { ... }
fn m_init_with_bytes_no_copy_length_encoding_free_when_done(
&mut self,
bytes: *mut c_void,
len: UInt,
encoding: Encoding,
free_buffer: bool,
) -> Self
where Self: Sized + FromId { ... }
fn m_init_with_characters_length(
&mut self,
characters: *const unichar,
len: UInt,
) -> Self
where Self: Sized + FromId { ... }
fn m_init_with_characters_no_copy_length_free_when_done(
&mut self,
characters: unichar,
length: UInt,
free_buffer: bool,
) -> Self
where Self: Sized + FromId { ... }
fn m_init_with_string<S>(&mut self, s: S) -> Self
where Self: Sized + FromId,
S: INSString { ... }
fn m_init_with_cstring_encoding(
&mut self,
c_str: *const c_char,
encoding: Encoding,
) -> Self
where Self: Sized + FromId { ... }
fn m_init_with_utf8_string(&mut self, c_str: *const c_char) -> Self
where Self: Sized + FromId { ... }
fn m_init_with_data_encoding(
&mut self,
data: NSData,
encoding: Encoding,
) -> Self
where Self: Sized + FromId { ... }
fn m_localized_user_notification_string_for_key_arguments<T>(
key: NSString,
arguments: NSArray<T>,
) -> NSString
where T: PNSObject { ... }
fn m_string_with_characters_length(
characters: *const unichar,
length: UInt,
) -> Self
where Self: Sized + FromId { ... }
fn m_string_with_string(s: NSString) -> Self
where Self: Sized + 'static + FromId { ... }
fn m_string_with_cstring_encoding(
c_str: *const c_char,
encoding: Encoding,
) -> Self
where Self: Sized + FromId { ... }
fn m_string_with_utf8_string(c_str: *const c_char) -> Self
where Self: Sized + FromId { ... }
fn m_string_with_contents_of_file_encoding(
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
where Self: Sized + FromId { ... }
fn m_init_with_contents_of_file_encoding(
&mut self,
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
where Self: Sized + FromId { ... }
fn m_string_with_contents_of_file_used_encoding(
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
where Self: Sized + FromId { ... }
fn m_init_with_contents_of_file_used_encoding(
&mut self,
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
where Self: Sized + FromId { ... }
fn m_string_with_contents_of_url_encoding(
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
where Self: Sized + FromId { ... }
fn m_init_with_contents_of_url_encoding(
&mut self,
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
where Self: Sized + FromId { ... }
fn m_string_with_contents_of_url_used_encoding(
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
where Self: Sized + FromId { ... }
fn m_init_with_contents_of_url_used_encoding(
&mut self,
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
where Self: Sized + FromId { ... }
fn p_length(&self) -> UInt { ... }
fn m_length_of_bytes_using_encoding(&self, enc: Encoding) -> UInt { ... }
fn m_maximum_length_of_bytes_using_encoding(&self, enc: Encoding) -> Int { ... }
fn m_character_at_index(&self, index: UInt) -> char { ... }
fn m_get_characters_range(&self, buffer: *mut unichar, range: NSRange) { ... }
fn m_get_bytes_max_length_used_length_encoding_options_range_remaining_range(
&self,
buffer: *mut c_void,
max_length: Int,
used_length: *mut Int,
encoding: Encoding,
options: NSStringEncodingConversionOptions,
range: NSRange,
remaining_range: NSRange,
) -> bool { ... }
fn m_c_string_using_encoding(&self, encoding: Encoding) -> *const c_char { ... }
fn m_get_cstring_max_length_encoding(
&self,
buffer: *mut c_char,
max_length: UInt,
encoding: Encoding,
) -> bool { ... }
fn p_utf8_string(&self) -> *const c_char { ... }
fn m_case_insensitive_compare<S>(&self, string: S) -> NSComparisonResult
where S: INSString { ... }
fn m_localized_case_insensitive_compare<S>(
&self,
string: S,
) -> NSComparisonResult
where S: INSString { ... }
fn m_compare<S>(&self, string: S) -> NSComparisonResult
where S: INSString { ... }
fn m_localized_compare<S>(&self, string: S) -> NSComparisonResult
where S: INSString { ... }
fn m_compare_options<S>(
&self,
string: S,
mask: NSStringCompareOptions,
) -> NSComparisonResult
where S: INSString { ... }
fn m_compare_options_range<S>(
&self,
string: S,
mask: NSStringCompareOptions,
range: NSRange,
) -> NSComparisonResult
where S: INSString { ... }
fn m_compare_options_range_locale<S>(
&self,
string: S,
mask: NSStringCompareOptions,
range: NSRange,
locale: NSLocale,
) -> NSComparisonResult
where S: INSString { ... }
fn m_localized_standard_compare<S>(&self, string: S) -> NSComparisonResult
where S: INSString { ... }
fn m_has_prefix<S>(&self, prefix: S) -> bool
where S: INSString { ... }
fn m_has_suffix<S>(&self, suffix: S) -> bool
where S: INSString { ... }
fn m_is_equal_to_string<S>(&self, string: S) -> bool
where S: INSString { ... }
fn m_string_by_appending_string<S>(&self, string: S) -> NSString
where S: INSString { ... }
fn m_string_by_padding_to_length_with_string_starting_at_index<S>(
&self,
new_length: UInt,
pad_string: S,
starting_at: UInt,
) -> NSString
where S: INSString { ... }
fn p_lowercase_string(&self) -> NSString { ... }
fn p_localized_lowercase_string(&self) -> NSString { ... }
fn m_lowercase_string_with_locale(&self, locale: NSLocale) -> NSString { ... }
fn p_uppercase_string(&self) -> NSString { ... }
fn p_localized_uppercase_string(&self) -> NSString { ... }
fn m_uppercase_string_with_locale(&self, locale: NSLocale) -> NSString { ... }
fn p_capitalized_string(&self) -> NSString { ... }
fn p_localized_capitalized_string(&self) -> NSString { ... }
fn m_capitalized_string_with_locale(&self, locale: NSLocale) -> NSString { ... }
fn m_components_separated_by_string<S>(
&self,
separator: S,
) -> NSArray<NSString>
where S: INSString { ... }
fn m_components_separated_by_characters_in_set(
&self,
separator: &NSCharacterSet,
) -> NSArray<NSString> { ... }
fn m_string_by_trimming_characters_in_set(
&self,
set: &NSCharacterSet,
) -> NSString { ... }
fn m_substring_from_index(&self, from: UInt) -> NSString { ... }
fn m_substring_with_range(&self, range: NSRange) -> NSString { ... }
fn m_substring_to_index(&self, to: UInt) -> NSString { ... }
fn p_decomposed_string_with_canonical_mapping(&self) -> NSString { ... }
fn p_decomposed_string_with_compatibility_mapping(&self) -> NSString { ... }
fn p_precomposed_string_with_canonical_mapping(&self) -> NSString { ... }
fn p_precomposed_string_with_compatibility_mapping(&self) -> NSString { ... }
fn m_string_by_folding_with_options_locale(
&mut self,
options: NSStringCompareOptions,
locale: &NSLocale,
) -> NSString { ... }
fn m_string_by_applying_transform_reverse(
&mut self,
transform: NSStringTransform,
reverse: bool,
) -> Option<NSString> { ... }
fn m_contains_string<S>(&self, other: S) -> bool
where S: INSString { ... }
fn p_available_string_encodings() -> *const Encoding { ... }
fn p_default_cstring_encoding() -> Encoding { ... }
fn m_can_be_converted_to_encoding(&self, encoding: Encoding) -> bool { ... }
fn m_data_using_encoding(&self, encoding: Encoding) -> NSData { ... }
}
Expand description
A trait containing all the methods for NSString
Provided Methods§
Sourcefn m_init(&mut self) -> Self
fn m_init(&mut self) -> Self
Returns an initialized NSString object that contains no characters.
Sourcefn m_init_with_bytes_length_encoding(
&mut self,
bytes: *const c_void,
len: UInt,
encoding: Encoding,
) -> Self
fn m_init_with_bytes_length_encoding( &mut self, bytes: *const c_void, len: UInt, encoding: Encoding, ) -> Self
Returns an initialized NSString object containing a given number of bytes from a given buffer of bytes interpreted in a given encoding.
§Arguments
-
bytes
- A buffer of bytes interpreted in the encoding specified by encoding. -
len
- The number of bytes to use from bytes. -
encoding
- The character encoding applied to bytes. For possible values, see NSStringEncoding.
§Returns
An initialized NSString object containing length bytes from bytes interpreted using the encoding encoding. The returned object may be different from the original receiver.
Sourcefn m_init_with_bytes_no_copy_length_encoding_free_when_done(
&mut self,
bytes: *mut c_void,
len: UInt,
encoding: Encoding,
free_buffer: bool,
) -> Self
fn m_init_with_bytes_no_copy_length_encoding_free_when_done( &mut self, bytes: *mut c_void, len: UInt, encoding: Encoding, free_buffer: bool, ) -> Self
Returns an initialized NSString object that contains a given number of bytes from a given buffer of bytes interpreted in a given encoding, and optionally frees the buffer.
§Arguments
bytes
- A buffer of bytes interpreted in the encoding specified by encoding.len
- The number of bytes to use from bytes.encoding
- The character encoding applied to bytes. For possible values, see NSStringEncoding.free_buffer
- If YES, bytes is freed after use.
§Returns
An initialized NSString object containing length bytes from bytes interpreted using the encoding encoding. The returned object may be different from the original receiver.
Sourcefn m_init_with_characters_length(
&mut self,
characters: *const unichar,
len: UInt,
) -> Self
fn m_init_with_characters_length( &mut self, characters: *const unichar, len: UInt, ) -> Self
Returns an initialized NSString object that contains a given number of characters from a given C array of UTF-16 code units.
§Arguments
characters
- A C array of UTF-16 code units; the value must not be NULL.length
- A C array of UTF-16 code units; the value must not be NULL.
§Returns
An initialized NSString object containing length characters from characters.
Sourcefn m_init_with_characters_no_copy_length_free_when_done(
&mut self,
characters: unichar,
length: UInt,
free_buffer: bool,
) -> Self
fn m_init_with_characters_no_copy_length_free_when_done( &mut self, characters: unichar, length: UInt, free_buffer: bool, ) -> Self
Returns an initialized NSString object that contains a given number of characters from a given C array of UTF-16 code units.
§Arguments
characters
- A C array of UTF-16 code units; the value must not be NULL.length
- A C array of UTF-16 code units; the value must not be NULL.free_buffer
- If YES, characters is freed after use.
§Returns
An initialized NSString object containing length characters from characters.
Sourcefn m_init_with_string<S>(&mut self, s: S) -> Self
fn m_init_with_string<S>(&mut self, s: S) -> Self
Sourcefn m_init_with_cstring_encoding(
&mut self,
c_str: *const c_char,
encoding: Encoding,
) -> Self
fn m_init_with_cstring_encoding( &mut self, c_str: *const c_char, encoding: Encoding, ) -> Self
Returns an NSString object initialized using the characters in a given C array, interpreted according to a given encoding.
§Arguments
c_str
- A C array of bytes.encoding
- The encoding to use to interpret c_str. For possible values, seeNSStringEncoding
.
§Returns
An NSString object initialized using the characters in c_str, interpreted according to encoding.
Sourcefn m_init_with_utf8_string(&mut self, c_str: *const c_char) -> Self
fn m_init_with_utf8_string(&mut self, c_str: *const c_char) -> Self
Sourcefn m_init_with_data_encoding(
&mut self,
data: NSData,
encoding: Encoding,
) -> Self
fn m_init_with_data_encoding( &mut self, data: NSData, encoding: Encoding, ) -> Self
Returns an NSString object initialized by converting given data into UTF-16 code units using a given encoding.
§Arguments
data
- The data to convert into UTF-16 code units.encoding
- The encoding to use to interpret data. For possible values, seeNSStringEncoding
.
§Returns
An NSString object initialized by converting data into UTF-16 code units using encoding.
Sourcefn m_localized_user_notification_string_for_key_arguments<T>(
key: NSString,
arguments: NSArray<T>,
) -> NSStringwhere
T: PNSObject,
fn m_localized_user_notification_string_for_key_arguments<T>(
key: NSString,
arguments: NSArray<T>,
) -> NSStringwhere
T: PNSObject,
Returns a localized string intended for display in a notification alert.
§Arguments
key
- The key to use when looking up the string in the app’s Localizable.strings file.arguments
- An array of values to substitute for escaped characters in the string.
Sourcefn m_string_with_characters_length(
characters: *const unichar,
length: UInt,
) -> Self
fn m_string_with_characters_length( characters: *const unichar, length: UInt, ) -> Self
Returns a string containing a given number of characters taken from a given C array of UTF-16 code units.
§Arguments
characters
- A C array of UTF-16 code units; the value must not be NULL.length
- A C array of UTF-16 code units; the value must not be NULL.
§Returns
An NSString object containing length characters from characters.
Sourcefn m_string_with_string(s: NSString) -> Self
fn m_string_with_string(s: NSString) -> Self
Sourcefn m_string_with_cstring_encoding(
c_str: *const c_char,
encoding: Encoding,
) -> Self
fn m_string_with_cstring_encoding( c_str: *const c_char, encoding: Encoding, ) -> Self
Returns a string containing the bytes in a given C array, interpreted according to a given encoding.
§Arguments
c_str
- A C array of bytes.encoding
- The encoding to use to interpret c_str. For possible values, seeNSStringEncoding
.
§Returns
An NSString object containing the bytes in c_str, interpreted according to encoding.
Sourcefn m_string_with_utf8_string(c_str: *const c_char) -> Self
fn m_string_with_utf8_string(c_str: *const c_char) -> Self
Sourcefn m_string_with_contents_of_file_encoding(
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
fn m_string_with_contents_of_file_encoding( path: &NSString, enc: Encoding, ) -> Result<Self, NSError>
Returns a string created by reading data from the file at a given path interpreted using a given encoding.
Sourcefn m_init_with_contents_of_file_encoding(
&mut self,
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
fn m_init_with_contents_of_file_encoding( &mut self, path: &NSString, enc: Encoding, ) -> Result<Self, NSError>
Returns an NSString
object initialized by reading data from the file at a given path using a given encoding.
Sourcefn m_string_with_contents_of_file_used_encoding(
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
fn m_string_with_contents_of_file_used_encoding( path: &NSString, enc: Encoding, ) -> Result<Self, NSError>
Returns an NSString
object initialized by reading data from the file at a given path using a given encoding.
Sourcefn m_init_with_contents_of_file_used_encoding(
&mut self,
path: &NSString,
enc: Encoding,
) -> Result<Self, NSError>
fn m_init_with_contents_of_file_used_encoding( &mut self, path: &NSString, enc: Encoding, ) -> Result<Self, NSError>
Returns a string created by reading data from the file at a given path and returns by reference the encoding used to interpret the file.
Sourcefn m_string_with_contents_of_url_encoding(
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
fn m_string_with_contents_of_url_encoding( path: &NSURL, enc: Encoding, ) -> Result<Self, NSError>
Returns a string created by reading data from a given URL interpreted using a given encoding.
Sourcefn m_init_with_contents_of_url_encoding(
&mut self,
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
fn m_init_with_contents_of_url_encoding( &mut self, path: &NSURL, enc: Encoding, ) -> Result<Self, NSError>
Returns an NSString
object initialized by reading data from a given URL interpreted using a given encoding.
Sourcefn m_string_with_contents_of_url_used_encoding(
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
fn m_string_with_contents_of_url_used_encoding( path: &NSURL, enc: Encoding, ) -> Result<Self, NSError>
Returns a string created by reading data from a given URL and returns by reference the encoding used to interpret the data.
Sourcefn m_init_with_contents_of_url_used_encoding(
&mut self,
path: &NSURL,
enc: Encoding,
) -> Result<Self, NSError>
fn m_init_with_contents_of_url_used_encoding( &mut self, path: &NSURL, enc: Encoding, ) -> Result<Self, NSError>
Returns an NSString
object initialized by reading data from a given URL and returns by reference the encoding used to interpret the data.
Sourcefn m_length_of_bytes_using_encoding(&self, enc: Encoding) -> UInt
fn m_length_of_bytes_using_encoding(&self, enc: Encoding) -> UInt
Returns the number of bytes required to store the receiver in a given encoding.
§Arguments
enc
- The encoding for which to determine the receiver’s length.
§Returns
The number of bytes required to store the receiver in the encoding enc in a non-external representation. The length does not include space for a terminating NULL character. Returns 0 if the specified encoding cannot be used to convert the receiver or if the amount of memory required for storing the results of the encoding conversion would exceed NSIntegerMax.
Sourcefn m_maximum_length_of_bytes_using_encoding(&self, enc: Encoding) -> Int
fn m_maximum_length_of_bytes_using_encoding(&self, enc: Encoding) -> Int
Returns the maximum number of bytes needed to store the receiver in a given encoding.
§Arguments
enc
- The encoding for which to determine the receiver’s length.
§Returns
The maximum number of bytes needed to store the receiver in encoding in a non-external representation. The length does not include space for a terminating NULL character. Returns 0 if the amount of memory required for storing the results of the encoding conversion would exceed NSIntegerMax.
Sourcefn m_character_at_index(&self, index: UInt) -> char
fn m_character_at_index(&self, index: UInt) -> char
Sourcefn m_get_characters_range(&self, buffer: *mut unichar, range: NSRange)
fn m_get_characters_range(&self, buffer: *mut unichar, range: NSRange)
Copies characters from a given range in the receiver into a given buffer.
§Arguments
buffer
- Upon return, contains the characters from the receiver. buffer must be large enough to contain the characters in the range aRange (aRange.length*sizeof(unichar)).range
- The range of characters to copy.
Sourcefn m_get_bytes_max_length_used_length_encoding_options_range_remaining_range(
&self,
buffer: *mut c_void,
max_length: Int,
used_length: *mut Int,
encoding: Encoding,
options: NSStringEncodingConversionOptions,
range: NSRange,
remaining_range: NSRange,
) -> bool
fn m_get_bytes_max_length_used_length_encoding_options_range_remaining_range( &self, buffer: *mut c_void, max_length: Int, used_length: *mut Int, encoding: Encoding, options: NSStringEncodingConversionOptions, range: NSRange, remaining_range: NSRange, ) -> bool
Gets a given range of characters as bytes in a specified encoding.
§Arguments
buffer
- Upon return, contains the bytes from the receiver. buffer must be large enough to contain the bytes in the range aRange (aRange.length*sizeof(char)).- `maxLength - The maximum number of bytes to get.
usedLength
- Upon return, contains the actual number of bytes retrieved.encoding
- The encoding to use to interpret the bytes. For possible values, seeNSStringEncoding
.options
- The options to use for converting the receiver into the specified encoding. For possible values, seeNSStringEncodingConversionOptions
.range
- The range of characters to get.remainingRange
- Upon return, contains a range containing the remaining characters.
Sourcefn m_c_string_using_encoding(&self, encoding: Encoding) -> *const c_char
fn m_c_string_using_encoding(&self, encoding: Encoding) -> *const c_char
Returns a representation of the string as a C string using a given encoding.
§Arguments
encoding
- The encoding to use to interpret the receiver. For possible values, seeNSStringEncoding
.
§Returns
A pointer to a C string containing the receiver. The pointer is owned by the string, and must not be freed by the caller.
Sourcefn m_get_cstring_max_length_encoding(
&self,
buffer: *mut c_char,
max_length: UInt,
encoding: Encoding,
) -> bool
fn m_get_cstring_max_length_encoding( &self, buffer: *mut c_char, max_length: UInt, encoding: Encoding, ) -> bool
Returns a representation of the string as a C string.
§Arguments
buffer
- Upon return, contains the characters from the receiver. buffer must be large enough to contain the characters in the receiver.maxLength
- The maximum number of bytes to write into buffer.encoding
- The encoding to use to interpret the receiver. For possible values, seeNSStringEncoding
.
§Returns
true
if the operation was successful, otherwise false
. Returns false
if conversion is not possible due to encoding errors or if buffer is too small.
Sourcefn p_utf8_string(&self) -> *const c_char
fn p_utf8_string(&self) -> *const c_char
A null-terminated UTF8 representation of the string.
Sourcefn m_case_insensitive_compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
fn m_case_insensitive_compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
Returns the result of invoking compare:options: with NSCaseInsensitiveSearch as the only option.
§Arguments
string
- The string to compare.
§Returns
Returns an ComparisonResult
value that indicates the lexical ordering.
OrderedAscending
the receiver precedes string
in lexical ordering,
OrderedSame
the receiver and string
are equivalent in lexical value,
and OrderedDescending
if the receiver follows string
.
Sourcefn m_localized_case_insensitive_compare<S>(
&self,
string: S,
) -> NSComparisonResultwhere
S: INSString,
fn m_localized_case_insensitive_compare<S>(
&self,
string: S,
) -> NSComparisonResultwhere
S: INSString,
Compares the string with a given string using a case-insensitive, localized, comparison.
§Arguments
string
- The string to compare.
§Returns
Returns an ComparisonResult
value that indicates the lexical ordering.
OrderedAscending
the receiver precedes string
in lexical ordering,
OrderedSame
the receiver and string
are equivalent in lexical value,
and OrderedDescending
if the receiver follows string
Sourcefn m_compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
fn m_compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
Returns the result of invoking compare:options:range: with no options and the receiver’s full extent as the range.
§Arguments
string
- The string with which to compare the receiver.
§Safety
This value must not be nil. If this value is nil, the behavior is undefined and may change in future versions of macOS.
§Returns
Returns an ComparisonResult
value that indicates the lexical ordering.
OrderedAscending
the receiver precedes string
in lexical ordering,
OrderedSame
the receiver and string
are equivalent in lexical value,
and OrderedDescending
if the receiver follows string
Sourcefn m_localized_compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
fn m_localized_compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
Returns the result of invoking compare:options:range: with no options and the receiver’s full extent as the range.
§Arguments
string
- The string with which to compare the receiver.
Returns an ComparisonResult
value that indicates the lexical ordering.
OrderedAscending
the receiver precedes string
in lexical ordering,
OrderedSame
the receiver and string
are equivalent in lexical value,
and OrderedDescending
if the receiver follows string
Sourcefn m_compare_options<S>(
&self,
string: S,
mask: NSStringCompareOptions,
) -> NSComparisonResultwhere
S: INSString,
fn m_compare_options<S>(
&self,
string: S,
mask: NSStringCompareOptions,
) -> NSComparisonResultwhere
S: INSString,
Sourcefn m_compare_options_range<S>(
&self,
string: S,
mask: NSStringCompareOptions,
range: NSRange,
) -> NSComparisonResultwhere
S: INSString,
fn m_compare_options_range<S>(
&self,
string: S,
mask: NSStringCompareOptions,
range: NSRange,
) -> NSComparisonResultwhere
S: INSString,
Compares the string with the specified string using the given options.
§Arguments
string
- The string to compare.mask
- The mask to use when comparing the receiver andstring
.range
- The range of the receiver to compare.
Sourcefn m_compare_options_range_locale<S>(
&self,
string: S,
mask: NSStringCompareOptions,
range: NSRange,
locale: NSLocale,
) -> NSComparisonResultwhere
S: INSString,
fn m_compare_options_range_locale<S>(
&self,
string: S,
mask: NSStringCompareOptions,
range: NSRange,
locale: NSLocale,
) -> NSComparisonResultwhere
S: INSString,
Compares the string using the specified options and returns the lexical ordering for the range.
§Arguments
string
- The string to compare.mask
- The mask to use when comparing the receiver andstring
.range
- The range to compare.locale
- The locale to use when comparing the receiver andstring
.
§Returns
Returns an ComparisonResult
value that indicates the lexical ordering.
Sourcefn m_localized_standard_compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
fn m_localized_standard_compare<S>(&self, string: S) -> NSComparisonResultwhere
S: INSString,
Sourcefn m_has_prefix<S>(&self, prefix: S) -> boolwhere
S: INSString,
fn m_has_prefix<S>(&self, prefix: S) -> boolwhere
S: INSString,
Sourcefn m_has_suffix<S>(&self, suffix: S) -> boolwhere
S: INSString,
fn m_has_suffix<S>(&self, suffix: S) -> boolwhere
S: INSString,
Sourcefn m_is_equal_to_string<S>(&self, string: S) -> boolwhere
S: INSString,
fn m_is_equal_to_string<S>(&self, string: S) -> boolwhere
S: INSString,
Sourcefn m_string_by_appending_string<S>(&self, string: S) -> NSStringwhere
S: INSString,
fn m_string_by_appending_string<S>(&self, string: S) -> NSStringwhere
S: INSString,
Returns a new string made by appending a given string to the receiver.
§Arguments
string
- The string to append to the receiver. This value must not be nil.
Sourcefn m_string_by_padding_to_length_with_string_starting_at_index<S>(
&self,
new_length: UInt,
pad_string: S,
starting_at: UInt,
) -> NSStringwhere
S: INSString,
fn m_string_by_padding_to_length_with_string_starting_at_index<S>(
&self,
new_length: UInt,
pad_string: S,
starting_at: UInt,
) -> NSStringwhere
S: INSString,
Returns a new string formed from the receiver by either removing characters from the end, or by appending as many occurrences as necessary of a given pad string.
§Arguments
new_length
- The number of characters to be contained in the new string.pad
- The string to use for padding.starting_at
- The index inpad_string
from which to start padding.
§Returns
A new string formed from the receiver by either removing characters from the end, or by appending as many occurrences of pad_string
as necessary.
Sourcefn p_lowercase_string(&self) -> NSString
fn p_lowercase_string(&self) -> NSString
A lowercase representation of the string.
Sourcefn p_localized_lowercase_string(&self) -> NSString
fn p_localized_lowercase_string(&self) -> NSString
Returns a version of the string with all letters converted to lowercase, taking into account the current locale.
Sourcefn m_lowercase_string_with_locale(&self, locale: NSLocale) -> NSString
fn m_lowercase_string_with_locale(&self, locale: NSLocale) -> NSString
Sourcefn p_uppercase_string(&self) -> NSString
fn p_uppercase_string(&self) -> NSString
An uppercase representation of the string.
Sourcefn p_localized_uppercase_string(&self) -> NSString
fn p_localized_uppercase_string(&self) -> NSString
Returns a version of the string with all letters converted to uppercase, taking into account the current locale.
Sourcefn m_uppercase_string_with_locale(&self, locale: NSLocale) -> NSString
fn m_uppercase_string_with_locale(&self, locale: NSLocale) -> NSString
Sourcefn p_capitalized_string(&self) -> NSString
fn p_capitalized_string(&self) -> NSString
A capitalized representation of the string.
Sourcefn p_localized_capitalized_string(&self) -> NSString
fn p_localized_capitalized_string(&self) -> NSString
Returns a capitalized representation of the receiver using the current locale.
Sourcefn m_capitalized_string_with_locale(&self, locale: NSLocale) -> NSString
fn m_capitalized_string_with_locale(&self, locale: NSLocale) -> NSString
Returns a capitalized representation of the receiver using the specified locale.
Sourcefn m_components_separated_by_string<S>(&self, separator: S) -> NSArray<NSString>where
S: INSString,
fn m_components_separated_by_string<S>(&self, separator: S) -> NSArray<NSString>where
S: INSString,
Returns an array containing substrings from the receiver that have been divided by a given separator.
Sourcefn m_components_separated_by_characters_in_set(
&self,
separator: &NSCharacterSet,
) -> NSArray<NSString>
fn m_components_separated_by_characters_in_set( &self, separator: &NSCharacterSet, ) -> NSArray<NSString>
Returns an array containing substrings from the receiver that have been divided by characters in a given set.
Sourcefn m_string_by_trimming_characters_in_set(
&self,
set: &NSCharacterSet,
) -> NSString
fn m_string_by_trimming_characters_in_set( &self, set: &NSCharacterSet, ) -> NSString
Returns a new string made by removing from both ends of the receiver characters contained in a given character set.
Sourcefn m_substring_from_index(&self, from: UInt) -> NSString
fn m_substring_from_index(&self, from: UInt) -> NSString
Returns a new string containing the characters of the receiver from the one at a given index to the end.
Sourcefn m_substring_with_range(&self, range: NSRange) -> NSString
fn m_substring_with_range(&self, range: NSRange) -> NSString
Returns a string object containing the characters of the receiver that lie within a given range.
Sourcefn m_substring_to_index(&self, to: UInt) -> NSString
fn m_substring_to_index(&self, to: UInt) -> NSString
Returns a new string containing the characters of the receiver up to, but not including, the one at a given index.
Sourcefn p_decomposed_string_with_canonical_mapping(&self) -> NSString
fn p_decomposed_string_with_canonical_mapping(&self) -> NSString
A string made by normalizing the string’s contents using the Unicode Normalization Form D.
Sourcefn p_decomposed_string_with_compatibility_mapping(&self) -> NSString
fn p_decomposed_string_with_compatibility_mapping(&self) -> NSString
A string made by normalizing the receiver’s contents using the Unicode Normalization Form KD.
Sourcefn p_precomposed_string_with_canonical_mapping(&self) -> NSString
fn p_precomposed_string_with_canonical_mapping(&self) -> NSString
A string made by normalizing the string’s contents using the Unicode Normalization Form C.
Sourcefn p_precomposed_string_with_compatibility_mapping(&self) -> NSString
fn p_precomposed_string_with_compatibility_mapping(&self) -> NSString
A string made by normalizing the receiver’s contents using the Unicode Normalization Form KC.
Sourcefn m_string_by_folding_with_options_locale(
&mut self,
options: NSStringCompareOptions,
locale: &NSLocale,
) -> NSString
fn m_string_by_folding_with_options_locale( &mut self, options: NSStringCompareOptions, locale: &NSLocale, ) -> NSString
Creates a string suitable for comparison by removing the specified character distinctions from a string.
Sourcefn m_string_by_applying_transform_reverse(
&mut self,
transform: NSStringTransform,
reverse: bool,
) -> Option<NSString>
fn m_string_by_applying_transform_reverse( &mut self, transform: NSStringTransform, reverse: bool, ) -> Option<NSString>
Returns a new string made by appending to the receiver a given string.
§Arguments
transform
- TheStringTransform
to apply.reverse
- Iftrue
, the transformation is applied in reverse.
Sourcefn m_contains_string<S>(&self, other: S) -> boolwhere
S: INSString,
fn m_contains_string<S>(&self, other: S) -> boolwhere
S: INSString,
Sourcefn p_available_string_encodings() -> *const Encoding
fn p_available_string_encodings() -> *const Encoding
Returns a zero-terminated list of the encodings string objects support in the application’s environment.
Sourcefn p_default_cstring_encoding() -> Encoding
fn p_default_cstring_encoding() -> Encoding
Returns the C-string encoding assumed for any method accepting a C string as an argument.
Sourcefn m_can_be_converted_to_encoding(&self, encoding: Encoding) -> bool
fn m_can_be_converted_to_encoding(&self, encoding: Encoding) -> bool
Returns a Boolean value that indicates whether the receiver can be converted to a given encoding without loss of information.
Sourcefn m_data_using_encoding(&self, encoding: Encoding) -> NSData
fn m_data_using_encoding(&self, encoding: Encoding) -> NSData
Returns an NSData object containing a representation of the receiver encoded using a given encoding.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.