---
title: deletingPathExtension
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/nsstring/deletingpathextension
---

# deletingPathExtension

A new string made by deleting the extension (if any, and only the last) from the receiver.

## Declaration

```swift
var deletingPathExtension: String { get }
```

## Discussion

Discussion A new string made by deleting the extension (if any, and only the last) from the receiver. Strips any trailing path separator before checking for an extension. If the receiver represents the root path, it is returned unaltered. The following table illustrates the effect of this method on a variety of different paths:  |   |   |   |   |   |   |  Note that attempting to delete an extension from @".tiff" causes the result to be @".tiff" instead of an empty string. This difference is because a file named @".tiff" is not considered to have an extension, so nothing is deleted. Note also that this method only works with file paths (not, for example, string representations of URLs).

## See Also

### Working with Paths

- [path(withComponents:)](foundation/nsstring/path(withcomponents:).md)
- [pathComponents](foundation/nsstring/pathcomponents.md)
- [completePath(into:caseSensitive:matchesInto:filterTypes:)](foundation/nsstring/completepath(into:casesensitive:matchesinto:filtertypes:).md)
- [fileSystemRepresentation](foundation/nsstring/filesystemrepresentation.md)
- [getFileSystemRepresentation(_:maxLength:)](foundation/nsstring/getfilesystemrepresentation(_:maxlength:).md)
- [isAbsolutePath](foundation/nsstring/isabsolutepath.md)
- [lastPathComponent](foundation/nsstring/lastpathcomponent.md)
- [pathExtension](foundation/nsstring/pathextension.md)
- [abbreviatingWithTildeInPath](foundation/nsstring/abbreviatingwithtildeinpath.md)
- [appendingPathComponent(_:)](foundation/nsstring/appendingpathcomponent(_:).md)
- [appendingPathExtension(_:)](foundation/nsstring/appendingpathextension(_:).md)
- [deletingLastPathComponent](foundation/nsstring/deletinglastpathcomponent.md)
- [expandingTildeInPath](foundation/nsstring/expandingtildeinpath.md)
- [resolvingSymlinksInPath](foundation/nsstring/resolvingsymlinksinpath.md)
- [standardizingPath](foundation/nsstring/standardizingpath.md)
