Contents

extension

The extension of this file or directory component.

Declaration

var `extension`: String? { get }

Discussion

If self does not contain a . anywhere, or only at the start, returns nil. Otherwise, returns everything after the dot.

Examples:

  • foo.txt => txt

  • foo.tar.gz => gz

  • Foo.app => app

  • .hidden => nil

  • .. => nil