public extension String {
/// 从url中获取后缀 例:.pdf
var pathExtension: String {
guard let url = URL(string: self) else { return "" }
return url.pathExtension.isEmpty ? "" : ".\(url.pathExtension)"
}
}
public extension String {
/// 从url中获取后缀 例:.pdf
var pathExtension: String {
guard let url = URL(string: self) else { return "" }
return url.pathExtension.isEmpty ? "" : ".\(url.pathExtension)"
}
}
本文标题:Swift 从urlString中获取后缀
本文链接:https://www.haomeiwen.com/subject/sngotqtx.html
网友评论