杨锴
2025-03-11 90dc3329d1973fda691e357cf4523d5c7c67fa1d
Pods/SwifterSwift/Sources/SwifterSwift/SwiftStdlib/StringExtensions.swift
@@ -115,7 +115,7 @@
    ///      "".firstCharacterAsString -> nil
    ///
    var firstCharacterAsString: String? {
        guard let first = first else { return nil }
        guard let first else { return nil }
        return String(first)
    }
@@ -285,7 +285,7 @@
    ///      "".lastCharacterAsString -> nil
    ///
    var lastCharacterAsString: String? {
        guard let last = last else { return nil }
        guard let last else { return nil }
        return String(last)
    }
@@ -442,6 +442,7 @@
    #if os(iOS) || os(tvOS)
    /// SwifterSwift: Check if the given string spelled correctly.
    @MainActor
    var isSpelledCorrectly: Bool {
        let checker = UITextChecker()
        let range = NSRange(startIndex..<endIndex, in: self)
@@ -600,7 +601,7 @@
    ///
    /// - Returns: The string in slug format.
    func toSlug() -> String {
        let lowercased = self.lowercased()
        let lowercased = lowercased()
        let latinized = lowercased.folding(options: .diacriticInsensitive, locale: Locale.current)
        let withDashes = latinized.replacingOccurrences(of: " ", with: "-")
@@ -753,7 +754,7 @@
    ///        "".firstCharacterUppercased() -> ""
    ///
    mutating func firstCharacterUppercased() {
        guard let first = first else { return }
        guard let first else { return }
        self = String(first).uppercased() + dropFirst()
    }
@@ -1228,8 +1229,7 @@
    /// - Parameter base64: base64 string.
    init?(base64: String) {
        guard let decodedData = Data(base64Encoded: base64) else { return nil }
        guard let str = String(data: decodedData, encoding: .utf8) else { return nil }
        self.init(str)
        self.init(data: decodedData, encoding: .utf8)
    }
    #endif
}