Skip to content

Instantly share code, notes, and snippets.

@dimohamdy
Created April 6, 2019 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimohamdy/198fea5c6a4955ec21e1f19c8aae2486 to your computer and use it in GitHub Desktop.
Save dimohamdy/198fea5c6a4955ec21e1f19c8aae2486 to your computer and use it in GitHub Desktop.
import Foundation
extension String {
func fileName() -> String {
return URL(fileURLWithPath: self).deletingPathExtension().lastPathComponent
}
func fileExtension() -> String {
return URL(fileURLWithPath: self).pathExtension
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment