Extended StructureSwift
String
extension String
Topics
Structures
struct ComparatorAStringcomparison performed using the given comparison options and locale.struct CompareOptionsThese options apply to the various search/find and comparison methods (except where noted).struct Encodingstruct StandardComparatorComparesStrings using one of a fixed set of standard comparison algorithms.
Initializers
init(_:)init?<S>(bytes: S, encoding: String.Encoding)Creates a new string equivalent to the given bytes interpreted in the specified encoding. Note: This API does not interpret embedded nulls as termination of the string. UseString?(validatingCString:)instead for null-terminated C strings.init(contentsOf: URL, encoding: String.Encoding) throwsProduces a string created by reading data from a given URL interpreted using a given encoding.init(contentsOf: URL, usedEncoding: inout String.Encoding) throwsProduces a string created by reading data from a given URL and returns by reference the encoding used to interpret the data.init(contentsOfFile: String, encoding: String.Encoding) throwsProduces a string created by reading data from the file at a given path interpreted using a given encoding.init(contentsOfFile: String, usedEncoding: inout String.Encoding) throwsProduces a string created by reading data from the file at a given path and returns by reference the encoding used to interpret the file.init?(data: Data, encoding: String.Encoding)Returns aStringinitialized by converting givendatainto Unicode characters using a givenencoding.