@available(macOS 10.10, iOS 8.0, watchOS 2.0, tvOS 9.0, *) public func components<T : StringProtocol>(separatedBy separator: T) -> [String] { #if FOUNDATION_FRAMEWORK if _foundation_essentials_feature_enabled() { if let contiguousSubstring = _asContiguousUTF8Substring(from: startIndex..<endIndex) { let options: String.CompareOptions if separator == "\n" { // 106365366: Some clients intend to separate strings whose line separator is "\r\n" with "\n". // Maintain compability with `.literal` so that "\n" can match that in "\r\n" on the unicode scalar level. options = [.literal] } else { options = [] } do { return try contiguousSubstring._components(separatedBy: Substring(separator), options: options) } catch { // Otherwise, inputs were unsupported - fallthrough to NSString implementation for compatibility } } } return _ns.components(separatedBy: separator._ephemeralString) #else do { return try Substring(self)._components(separatedBy: Substring(separator), options: []) } catch { return [String(self)] } #endif }