Open ClassFoundation5.9.0
NSString
class NSString
Superclasses
class NSObject
The root class of most Foundation class hierarchies.
Citizens in Foundation
Conformances
protocol CVarArg
A type whose instances can be encoded, and appropriately passed, as elements of a C
va_list
.protocol Comparable
A type that can be compared using the relational operators
<
,<=
,>=
, and>
.protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol ExpressibleByExtendedGraphemeClusterLiteral
A type that can be initialized with a string literal containing a single extended grapheme cluster.
protocol ExpressibleByStringLiteral
A type that can be initialized with a string literal.
protocol ExpressibleByUnicodeScalarLiteral
A type that can be initialized with a string literal containing a single Unicode scalar value.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol NSCoding
The
NSCoding
protocol declares the two methods that a class must implement so that instances of that class can be encoded and decoded. This capability provides the basis for archiving (where objects and other structures are stored on disk) and distribution (where objects are copied to different address spaces).protocol NSCopying
The
NSCopying
protocol declares a method for providing functional copies of an object. The exact meaning of “copy” can vary from class to class, but a copy must be a functionally independent object with values identical to the original at the time the copy was made.protocol NSMutableCopying
The
NSMutableCopying
protocol declares a method for providing mutable copies of an object. Only classes that define an “immutable vs. mutable” distinction should adopt this protocol. Classes that don’t define such a distinction should adoptNSCopying
instead.protocol NSObjectProtocol
The
NSObjectProtocol
groups methods that are fundamental to all Foundation objects.protocol NSSecureCoding
Conforming to the
NSSecureCoding
protocol indicates that an object handles encoding and decoding instances of itself in a manner that is robust against object substitution attacks.
Members
convenience init(
) convenience init?(bytes: UnsafeRawPointer, length: Int, encoding: UInt
) convenience init?(bytesNoCopy: UnsafeMutableRawPointer, length: Int, encoding: UInt, freeWhenDone: Bool
) convenience init?(cString: UnsafePointer<Int8>, encoding: UInt
) init(characters: UnsafePointer<unichar>, length: Int
) convenience init(charactersNoCopy: UnsafeMutablePointer<unichar>, length: Int, freeWhenDone: Bool
) convenience init?(coder: NSCoder
) convenience init(contentsOf: URL, encoding: UInt
) throws convenience init(contentsOf: URL, usedEncoding: UnsafeMutablePointer<UInt>?
) throws convenience init(contentsOfFile: String, encoding: UInt
) throws convenience init(contentsOfFile: String, usedEncoding: UnsafeMutablePointer<UInt>?
) throws convenience init?(data: Data, encoding: UInt
) convenience init(extendedGraphemeClusterLiteral: StaticString
) convenience init(format: NSString, CVarArg...
) convenience init(format: String, arguments: CVaListPointer
) convenience init(format: String, locale: AnyObject?, arguments: CVaListPointer
) convenience init(string: String
) init(stringLiteral: StaticString
) convenience init(unicodeScalarLiteral: StaticString
) convenience init?(utf8String: UnsafePointer<Int8>
) static var supportsSecureCoding: Bool
static func path(withComponents: [String]
) -> String class var availableStringEncodings: UnsafePointer<UInt>
class var defaultCStringEncoding: UInt
class func localizedName(of: UInt
) -> String var boolValue: Bool
var capitalized: String
var decomposedStringWithCanonicalMapping: String
var decomposedStringWithCompatibilityMapping: String
var deletingLastPathComponent: String
var deletingPathExtension: String
var description: String
var doubleValue: Double
var expandingTildeInPath: String
var fastestEncoding: UInt
var fileSystemRepresentation: UnsafePointer<Int8>
var floatValue: Float
var hash: Int
var intValue: Int32
var integerValue: Int
var isAbsolutePath: Bool
var lastPathComponent: String
var length: Int
var localizedCapitalized: String
var localizedLowercase: String
var localizedUppercase: String
var longLongValue: Int64
var lowercased: String
var pathComponents: [String]
var pathExtension: String
var precomposedStringWithCanonicalMapping: String
var precomposedStringWithCompatibilityMapping: String
var removingPercentEncoding: String?
var resolvingSymlinksInPath: String
var smallestEncoding: UInt
var standardizingPath: String
var uppercased: String
var utf8String: UnsafePointer<Int8>?
static func < (NSString, NSString
) -> Bool func addingPercentEncoding(withAllowedCharacters: CharacterSet
) -> String? func appending(String
) -> String func appendingPathComponent(String
) -> String func appendingPathExtension(String
) -> String? func applyingTransform(StringTransform, reverse: Bool
) -> String? func cString(using: UInt
) -> UnsafePointer<Int8>? func canBeConverted(to: UInt
) -> Bool func capitalized(with: Locale?
) -> String func caseInsensitiveCompare(String
) -> ComparisonResult func character(at: Int
) -> unichar func commonPrefix(with: String, options: NSString.CompareOptions
) -> String func compare(String
) -> ComparisonResult func compare(String, options: NSString.CompareOptions
) -> ComparisonResult func compare(String, options: NSString.CompareOptions, range: NSRange
) -> ComparisonResult func compare(String, options: NSString.CompareOptions, range: NSRange, locale: Any?
) -> ComparisonResult func completePath(into: inout String?, caseSensitive: Bool, matchesInto: inout [String], filterTypes: [String]?
) -> Int func components(separatedBy: CharacterSet
) -> [String] func components(separatedBy: String
) -> [String] func contains(String
) -> Bool func copy(
) -> Any func copy(with: NSZone?
) -> Any func data(using: UInt
) -> Data? func data(using: UInt, allowLossyConversion: Bool
) -> Data? func encode(with: NSCoder
) func enumerateLines((String, UnsafeMutablePointer<ObjCBool>) -> Void
) func enumerateSubstrings(in: NSRange, options: NSString.EnumerationOptions, using: (String?, NSRange, NSRange, UnsafeMutablePointer<ObjCBool>) -> Void
) func folding(options: NSString.CompareOptions, locale: Locale?
) -> String func getBytes(UnsafeMutableRawPointer
?, maxLength: Int, usedLength: UnsafeMutablePointer<Int>?, encoding: UInt, options: NSString.EncodingConversionOptions, range: NSRange, remaining: NSRangePointer?) -> Bool func getCString(UnsafeMutablePointer
<Int8>, maxLength: Int, encoding: UInt) -> Bool func getCharacters(UnsafeMutablePointer
<unichar>, range: NSRange) func getFileSystemRepresentation(UnsafeMutablePointer
<Int8>, maxLength: Int) -> Bool func getLineStart(UnsafeMutablePointer
<Int>?, end: UnsafeMutablePointer<Int>?, contentsEnd: UnsafeMutablePointer<Int>?, for: NSRange) func getParagraphStart(UnsafeMutablePointer
<Int>?, end: UnsafeMutablePointer<Int>?, contentsEnd: UnsafeMutablePointer<Int>?, for: NSRange) func hasPrefix(String
) -> Bool func hasSuffix(String
) -> Bool func isEqual(Any
?) -> Bool func isEqual(to: String
) -> Bool func lengthOfBytes(using: UInt
) -> Int func lineRange(for: NSRange
) -> NSRange func localizedCaseInsensitiveCompare(String
) -> ComparisonResult func localizedCaseInsensitiveContains(String
) -> Bool func localizedCompare(String
) -> ComparisonResult func localizedStandardCompare(String
) -> ComparisonResult func localizedStandardContains(String
) -> Bool func localizedStandardRange(of: String
) -> NSRange func lowercased(with: Locale?
) -> String func maximumLengthOfBytes(using: UInt
) -> Int func mutableCopy(
) -> Any func mutableCopy(with: NSZone?
) -> Any func padding(toLength: Int, withPad: String, startingAt: Int
) -> String func paragraphRange(for: NSRange
) -> NSRange func range(of: String
) -> NSRange func range(of: String, options: NSString.CompareOptions
) -> NSRange func range(of: String, options: NSString.CompareOptions, range: NSRange
) -> NSRange func range(of: String, options: NSString.CompareOptions, range: NSRange, locale: Locale?
) -> NSRange func rangeOfCharacter(from: CharacterSet
) -> NSRange func rangeOfCharacter(from: CharacterSet, options: NSString.CompareOptions
) -> NSRange func rangeOfCharacter(from: CharacterSet, options: NSString.CompareOptions, range: NSRange
) -> NSRange func rangeOfComposedCharacterSequence(at: Int
) -> NSRange func rangeOfComposedCharacterSequences(for: NSRange
) -> NSRange func replacingCharacters(in: NSRange, with: String
) -> String func replacingOccurrences(of: String, with: String
) -> String func replacingOccurrences(of: String, with: String, options: NSString.CompareOptions, range: NSRange
) -> String func stringsByAppendingPaths([String]
) -> [String] func substring(from: Int
) -> String func substring(to: Int
) -> String func substring(with: NSRange
) -> String func trimmingCharacters(in: CharacterSet
) -> String func uppercased(with: Locale?
) -> String func write(to: URL, atomically: Bool, encoding: UInt
) throws func write(toFile: String, atomically: Bool, encoding: UInt
) throws struct CompareOptions
struct EncodingConversionOptions
struct EnumerationOptions
Features
static func ... (Self
) -> PartialRangeFrom<Self> Returns a partial range extending upward from a lower bound.
static func ... (Self
) -> PartialRangeThrough<Self> Returns a partial range up to, and including, its upper bound.
static func ... (Self, Self
) -> ClosedRange<Self> Returns a closed range that contains both of its bounds.
static func ..< (Self
) -> PartialRangeUpTo<Self> Returns a partial range up to, but not including, its upper bound.
static func ..< (Self, Self
) -> Range<Self> Returns a half-open range that contains its lower bound but not its upper bound.