Source File
bytes.go
Belonging Package
github.com/gofiber/fiber/v2/utils
// ⚡️ 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
// ToLowerBytes converts ascii slice to lower-case in-place.
func ( []byte) []byte {
for := 0; < len(); ++ {
[] = toLowerTable[[]]
}
return
}
// ToUpperBytes converts ascii slice to upper-case in-place.
func ( []byte) []byte {
for := 0; < len(); ++ {
[] = toUpperTable[[]]
}
return
}
// TrimRightBytes is the equivalent of bytes.TrimRight
func ( []byte, byte) []byte {
:= len()
for > 0 && [-1] == {
--
}
return [:]
}
// TrimLeftBytes is the equivalent of bytes.TrimLeft
func ( []byte, byte) []byte {
, := len(), 0
for < && [] == {
++
}
return [:]
}
// TrimBytes is the equivalent of bytes.Trim
func ( []byte, byte) []byte {
, := 0, len()-1
for ; <= ; ++ {
if [] != {
break
}
}
for ; < ; -- {
if [] != {
break
}
}
return [ : +1]
}
// EqualFoldBytes tests ascii slices for equality case-insensitively
func (, []byte) bool {
if len() != len() {
return false
}
for := len() - 1; >= 0; -- {
if toUpperTable[[]] != toUpperTable[[]] {
return false
}
}
return true
}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |