-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathstrings.go
More file actions
40 lines (35 loc) · 1.09 KB
/
strings.go
File metadata and controls
40 lines (35 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// ⚡️ Fiber is an Express inspired web framework written in Go with ☕️
// 🤖 Github Repository: https://github.com/gofiber/fiber
// 📌 API Documentation: https://docs.gofiber.io
package utils
import (
casestrings "github.com/gofiber/utils/v2/strings"
)
// ToLower converts ascii string to lower-case.
//
// Deprecated: use package "github.com/gofiber/utils/v2/strings" and call strings.ToLower.
func ToLower(b string) string {
return casestrings.ToLower(b)
}
// ToUpper converts ascii string to upper-case.
//
// Deprecated: use package "github.com/gofiber/utils/v2/strings" and call strings.ToUpper.
func ToUpper(b string) string {
return casestrings.ToUpper(b)
}
// AddTrailingSlashString appends a trailing '/' to s if it does not already end with one.
// If the input already ends with '/', the original string is returned.
// A new string is returned only when a '/' needs to be appended.
func AddTrailingSlashString(s string) string {
n := len(s)
if n == 0 {
return "/"
}
if s[n-1] == '/' {
return s
}
buf := make([]byte, n+1)
copy(buf, s)
buf[n] = '/'
return UnsafeString(buf)
}