'\" t .\" Copyright (c) 2025 Bruce Hill .\" All rights reserved. .\" .TH Path.extension 3 2025-11-29 "Tomo man-pages" .SH NAME Path.extension \- get file extension .SH LIBRARY Tomo Standard Library .SH SYNOPSIS .nf .BI Path.extension\ :\ func(path:\ Path,\ full:\ Bool\ =\ yes\ ->\ Text) .fi .SH DESCRIPTION Returns the file extension of the file at the specified path. Optionally returns the full extension. .SH ARGUMENTS .TS allbox; lb lb lbx lb l l l l. Name Type Description Default path Path The path of the file. - full Bool Whether to return everything after the first \fB.\fR in the base name, or only the last part of the extension. yes .TE .SH RETURN The file extension (not including the leading `.`) or an empty text if there is no file extension. .SH EXAMPLES .EX assert (./file.tar.gz).extension() == "tar.gz" assert (./file.tar.gz).extension(full=no) == "gz" assert (/foo).extension() == "" assert (./.git).extension() == "" .EE .SH SEE ALSO .BR Tomo-Path (3)