mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
committed by
Bjørn Erik Pedersen
parent
f5e54d9c7d
commit
d37606d2c2
@@ -450,6 +450,17 @@ func (ns *Namespace) Trim(s, cutset any) (string, error) {
|
||||
return strings.Trim(ss, sc), nil
|
||||
}
|
||||
|
||||
// TrimSpace returns the given string, removing leading and trailing whitespace
|
||||
// as defined by Unicode.
|
||||
func (ns *Namespace) TrimSpace(s any) (string, error) {
|
||||
ss, err := cast.ToStringE(s)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return strings.TrimSpace(ss), nil
|
||||
}
|
||||
|
||||
// TrimLeft returns a slice of the string s with all leading characters
|
||||
// contained in cutset removed.
|
||||
func (ns *Namespace) TrimLeft(cutset, s any) (string, error) {
|
||||
|
Reference in New Issue
Block a user