-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
StringByAppendingPathComponent.swift
60 lines (43 loc) · 1.28 KB
/
StringByAppendingPathComponent.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// StringByAppendingPathComponent.swift
// AppSigner
//
// Created by Daniel Radtke on 11/3/15.
// Copyright © 2015 Daniel Radtke. All rights reserved.
//
import Foundation
extension String {
var lastPathComponent: String {
get {
return (self as NSString).lastPathComponent
}
}
var pathExtension: String {
get {
return (self as NSString).pathExtension
}
}
var stringByDeletingLastPathComponent: String {
get {
return (self as NSString).deletingLastPathComponent
}
}
var stringByDeletingPathExtension: String {
get {
return (self as NSString).deletingPathExtension
}
}
var pathComponents: [String] {
get {
return (self as NSString).pathComponents
}
}
func stringByAppendingPathComponent(_ path: String) -> String {
let nsSt = self as NSString
return nsSt.appendingPathComponent(path)
}
func stringByAppendingPathExtension(_ ext: String) -> String? {
let nsSt = self as NSString
return nsSt.appendingPathExtension(ext)
}
}