pathutils

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsRelativePathSegments

func ContainsRelativePathSegments[T ~string](pth T) bool

ContainsRelativePathSegments reports whether $pth contains '.' or '..' segments.

func ForEachAbsolutePathSegment

func ForEachAbsolutePathSegment[T ~string](pth T, fn func(segment string, startIndex, endIndex int) error) error

ForEachAbsolutePathSegment calls fn for each segment of pth, adjacent '/' characters are treated as a single '/' character. The path is not cleaned, so fn may be invoked with '.' or '..' as segment. The function panics if pth does not start with '/'.

func ForEachPathSegment

func ForEachPathSegment[T ~string](pth T, fn func(segment string, startIndex, endIndex int) error) error

ForEachPathSegment calls fn for each segment of pth, adjacent '/' characters are treated as a single '/' character. The path is not cleaned, so fn may be invoked with '.' or '..' as segment.

func GetLastPathSegment

func GetLastPathSegment(pth string) string

func GetPathSegments

func GetPathSegments[T ~string](pth T) []string

GetPathSegments returns the segments of pth, adjacent '/' characters are treated as a single '/' character.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL