Documentation
¶
Index ¶
- func BaseName(str string) string
- func CleanString(str string, r *regexp.Regexp) string
- func DelInitialSlash(path string) string
- func EndsWithSlash(path string) string
- func FileNameISO8601(fileName string) string
- func FilenameWithoutExtension(fileName string) string
- func LoadDataFromJSON(body interface{}, fileName string) error
- func LoadDataFromYAML(body interface{}, fileName string) error
- func Name(str string) string
- func ReadFile(fileName string) []byte
- func ValidFileName(folderName, fileName string) string
- func WriteDataToJSON(body interface{}, fileName string) error
- func WriteDataToYAML(body interface{}, fileName string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BaseName ¶
BaseName makes a string safe to use in a file name, producing a sanitized basename replacing . or / with -. No attempt is made to normalise a path or normalise case.
func CleanString ¶
CleanString replaces separators with - and removes characters listed in the regexp provided from string. Accents, spaces, and all characters not in A-Za-z0-9 are replaced.
func DelInitialSlash ¶
DelInitialSlash just delete (if exists) a initial /
func EndsWithSlash ¶
EndsWithSlash just check if a path ends with /, if not add
func FileNameISO8601 ¶
FileNameISO8601 returns a valid fileName with ISO8606 timestamp on it
func FilenameWithoutExtension ¶ added in v1.0.2
FilenameWithoutExtension returns a valid fileName without extension
func LoadDataFromJSON ¶ added in v1.0.1
LoadDataFromJSON reads a JSON format file and returns its contents on body
func LoadDataFromYAML ¶ added in v1.0.1
LoadDataFromYAML reads a YAML format file and returns its contents on body
func Name ¶
Name makes a string safe to use in a file name by first finding the path basename, then replacing non-ascii characters.
func ValidFileName ¶
ValidFileName returns a valid fileName without not-ascii characters
func WriteDataToJSON ¶ added in v1.0.1
WriteDataToJSON saves the content of body in a JSON format file
func WriteDataToYAML ¶ added in v1.0.1
WriteDataToYAML saves the content of body in a YAML format file
Types ¶
This section is empty.