MoviaBox/ShortPlay/Base/Extension/String+SPAdd.swift
2025-04-09 18:24:58 +08:00

29 lines
642 B
Swift

//
// String+SPAdd.swift
// ShortPlay
//
// Created by on 2025/4/8.
//
import UIKit
import SmartCodable
extension String: SmartCodable {
func length() -> Int {
return self.ocString().length
}
func ocString() -> NSString {
return self as NSString
}
static func timeZone() -> String {
let timeZone = NSTimeZone.local as NSTimeZone
let timeZoneAbbreviation = timeZone.name.length() > 0 ? timeZone.name : "Unknown"
let timeZoneSecondsFromGMT = timeZone.secondsFromGMT / 3600
return String(format: "GMT+0%d:00", timeZoneSecondsFromGMT)
}
}