fopa

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2025 License: BSD-3-Clause Imports: 3 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
}

todo

  • move scrape.go to internal
    • move Forbidden{Char,Rule} funcs to root
  • generate {rule,char} table
  • [ ]

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

ForbiddenChars returns a slice of the characters this library forbids

func Redux

func Redux(path string) string

Redux remove runs of the fill character

func Reduxf

func Reduxf(path, fill string) string

Redux removes 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

This section is empty.

Directories

Path Synopsis
cmd
fopa command
fetch command
parse command

Jump to

Keyboard shortcuts

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