mas/Tests/masTests/Extensions/String+FileExtension.swift

22 lines
452 B
Swift
Raw Permalink Normal View History

2019-01-06 19:26:08 +00:00
//
// String+FileExtension.swift
// masTests
2019-01-06 19:26:08 +00:00
//
// Created by Ben Chatelain on 1/5/19.
// Copyright © 2019 mas-cli. All rights reserved.
//
import Foundation
extension String {
/// Returns the file name before the extension.
var fileNameWithoutExtension: String {
2021-03-22 05:46:17 +00:00
(self as NSString).deletingPathExtension
2019-01-06 19:26:08 +00:00
}
/// Returns the file extension.
var fileExtension: String {
2021-03-22 05:46:17 +00:00
(self as NSString).pathExtension
2019-01-06 19:26:08 +00:00
}
}