29 lines
642 B
Swift
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)
|
|
}
|
|
|
|
}
|