bytes.go 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. // ⚡️ Fiber is an Express inspired web framework written in Go with ☕️
  2. // 🤖 Github Repository: https://github.com/gofiber/fiber
  3. // 📌 API Documentation: https://docs.gofiber.io
  4. package utils
  5. import (
  6. casebytes "github.com/gofiber/utils/v2/bytes"
  7. )
  8. // ToLowerBytes converts an ASCII byte slice to lower-case in-place.
  9. //
  10. // Deprecated: use package "github.com/gofiber/utils/v2/bytes" and call bytes.UnsafeToLower.
  11. // This wrapper keeps backward compatibility by mutating the provided slice.
  12. func ToLowerBytes(b []byte) []byte {
  13. return casebytes.UnsafeToLower(b)
  14. }
  15. // ToUpperBytes converts an ASCII byte slice to upper-case in-place.
  16. //
  17. // Deprecated: use package "github.com/gofiber/utils/v2/bytes" and call bytes.UnsafeToUpper.
  18. // This wrapper keeps backward compatibility by mutating the provided slice.
  19. func ToUpperBytes(b []byte) []byte {
  20. return casebytes.UnsafeToUpper(b)
  21. }
  22. // AddTrailingSlashBytes appends a trailing '/' to b if it does not already end with one.
  23. // If the input already ends with '/', the original slice is returned.
  24. // A new slice is returned when a '/' is appended. The original slice is never modified.
  25. func AddTrailingSlashBytes(b []byte) []byte {
  26. return UnsafeBytes(AddTrailingSlashString(UnsafeString(b)))
  27. }