filepathhelper

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 4 Imported by: 0

README

filepathhelper

Go Reference

Helpers for Go's filepath package.

Documentation

Overview

Package filepathhelper contains path/filepath package helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeExt

func ChangeExt(path, ext string) string

ChangeExt changes extension of 'path' to 'ext'. 'ext' may or may not start with dot. If 'path' or 'ext' is empty or 'ext' is ".", 'path' is returned.

func EndSeparator

func EndSeparator(path string) string

EndSeparator returns 'path' guaranteed to end with filepath.Separator. If 'path' is empty, empty string is returned.

func Random added in v0.2.0

func Random() string

Random returns a random name (for directory or file).

func Split added in v0.1.0

func Split(path string) []string

Split splits 'path' (using filepath.Separator as separator) into slice of strings containing directory names and filename. (E.g. on Windows "a\b\c.d" is split into {"a", "b", "c.d"} slice.)

func StartSeparator

func StartSeparator(path string) string

StartSeparator returns 'path' guaranteed to start with filepath.Separator. If 'path' is empty, empty string is returned.

func WithoutExt added in v0.3.0

func WithoutExt(path string) string

WithoutExt returns 'path' without extension and corresponding dot. If 'path' ends with dot, the dot is removed. If 'path' has no extension or is empty, 'path' is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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