sanitizer

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package sanitizer 内容修正工具

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[T interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~float32 | ~float64
}](v *T)

Abs 转为绝对值

func BR2NL

func BR2NL(v *string)

BR2NL 将 <br /> 转换为换行符

func Escape

func Escape(v *string)

func Lower

func Lower(v *string)

func MD5

func MD5(v *string)

func MS

func MS[M ~map[K]V, K comparable, V any](f func(*V)) filter.Rule[M]

MS 同 filter.MS

func NL2BR

func NL2BR(v *string)

NL2BR 将换行符转换为 <br />

func NL2P

func NL2P(v *string)

NL2P 将换行符转换为 <p> 包含的元素

规则如下:

l1  => <p>l1</p>
l2\nl2 => <p>l1</p><p>l2</p>

func P2NL

func P2NL(v *string)

P2NL 将 <p> 包含的元素替换为换行符

func S

func S[T any](f ...func(*T)) filter.Rule[T]

S 同 filter.S

func SS

func SS[S ~[]T, T any](f ...func(*T)) filter.Rule[S]

SS 同 filter.SS

func Sanitizers

func Sanitizers[T any](f ...func(*T)) func(*T)

Sanitizers 将多个修正函数合并为一个

func Trim

func Trim(v *string)

Trim 过滤左右空格

func TrimLeft

func TrimLeft(v *string)

func TrimRight

func TrimRight(v *string)

func Unescape

func Unescape(v *string)

func Upper

func Upper(v *string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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