fopa

package module
v0.0.0-...-a6116a0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

README

fopa

Forbidden Paths Sanitize a file's path so that it has consistent across common operating systems and the web.

package main

import "github.com/kendfss/fopa"

func main() {
    path := "%# "
    println(fopa.Sanitize(path)) // ___
    println(fopa.Sanitizef(path, "*")) // ***, but this is also forbidden
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Filler = "_"
)

Functions

func Clean

func Clean(path string) string

Sanitize and Redux a filepath

func Cleanf

func Cleanf(path, fill string) string

Sanitize and Redux a filepath, with a format string

func ForbiddenChars

func ForbiddenChars() []string

func Map

func Map[Arg, Val any](fn func(Arg) Val, args ...Arg) []Val

func Redux

func Redux(path string) string

remove runs of the fill character

func Reduxf

func Reduxf(path, fill string) string

remove runs of the fill character, with a format string

func Sanitize

func Sanitize(path string) string

remove illegal characters from a file path

func Sanitizef

func Sanitizef(path, fill string) string

remove illegal characters from a file path

Types

type Rule

type Rule struct {
	Symb string `json:"symb"`
	Desc string `json:"name"`
}

func ForbiddenRules

func ForbiddenRules() []Rule

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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