Skip to content

Commit fd57021

Browse files
authored
Add documentation clarifying trailing slashes for basename (#37580)
1 parent 0ef55f5 commit fd57021

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

base/path.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,17 @@ See also: [`basename`](@ref)
165165
166166
Get the file name part of a path.
167167
168+
!!! note
169+
This function differs slightly from the Unix `basename` program, where trailing slashes are ignored,
170+
i.e. `\$ basename /foo/bar/` returns `bar`, whereas `basename` in Julia returns an empty string `""`.
171+
168172
# Examples
169173
```jldoctest
170174
julia> basename("/home/myuser/example.jl")
171175
"example.jl"
176+
177+
julia> basename("/home/myuser/")
178+
""
172179
```
173180
174181
See also: [`dirname`](@ref)

0 commit comments

Comments
 (0)