Documentation
¶
Index ¶
- Variables
- func CheckUnderscore(value rune) bool
- func Highlight(text, left, right, sample string) (string, error)
- func Replace[I ~string | ~[]rune](input I, replacementChar rune, additionalCheckers ...func(value rune) bool) string
- func ReplaceNonAlphanumeric[I ~string | ~[]rune](input I, replacementChar rune) string
- func Validate[I ~string](input I, additionalCheckers ...func(value rune) bool) error
- func ValidateOnly[I ~string](input I, validators ...func(value rune) bool) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CheckUnderscore ¶
CheckUnderscore checks underscore character.
func Highlight ¶ added in v1.2.1
Highlight takes in some content and locations and then inserts left/right, strings which can be used for highlighting around matching terms. For example, if you pass in "test" with sample "te", you will have "<strong>te</strong>st" as return.
func Replace ¶ added in v1.1.0
func Replace[I ~string | ~[]rune](input I, replacementChar rune, additionalCheckers ...func(value rune) bool) string
Replace substitutes characters that don't match the a-zA-Z0-9 pattern or additional validators with the specified replacement character. Returns the modified string.
func ReplaceNonAlphanumeric ¶ added in v1.4.0
ReplaceNonAlphanumeric replaces all non-alphanumeric characters (not a-zA-Z0-9) in the input string with the specified replacement character. Provides an efficient way to sanitize a string to contain only alphanumeric characters.
func Validate ¶
Validate checks if all characters in the input string match the a-zA-Z0-9 pattern. Additional character validation can be provided through custom checker functions. Returns ErrIncorrectCharacter if any character doesn't match the pattern.
func ValidateOnly ¶ added in v1.2.5
ValidateOnly checks if all characters in the input string match only the provided character validation functions. Returns ErrIncorrectCharacter if any character doesn't pass the provided validators.
Types ¶
This section is empty.