aboutsummaryrefslogtreecommitdiff
path: root/man/man3/tomo-Path.extension.3
blob: 71b65f77355e77148e935d830abb9d077d6dd4a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'\" 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)