Documentation
¶
Index ¶
- type Rule
- func Replace(substringsAndRepl ...string) Rule
- func ReplaceRegexp(patternsAndRepl ...string) Rule
- func Strip(substrings ...string) Rule
- func StripRange(ranges ...int32) Rule
- func StripRegexp(patterns ...string) Rule
- func StripRune(runes ...rune) Rule
- func Truncate(length int, omission string, pos truncate.TruncatePosition) Rule
- type Ruleset
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rule ¶
Rule represents a file sanitization rule, a function that turns (potentially) invalid input string into valid output.
func Replace ¶
Replace replaces met substrings (all varargs except the last one) with a replacement string (last vararg.) It panics if there were less than two arguments provided.
func ReplaceRegexp ¶
ReplaceRegexp replaces matched patterns (all varargs except the last one) with a replacement string (last vararg.) It panics if there were less than two arguments provided.
func Strip ¶
Strip is a convenience call to Replace with last argument being an empty string. It panics if there was less than one argument provided.
func StripRange ¶
StripRange removes runes in the provided ranges (defined as paired varargs min-max) from the input string. It panics if odd amount of arguments was provided.
func StripRegexp ¶
StripRegexp is a convenience call to ReplaceRegexp with last argument being an empty string.