Files
gf/text/gstr/gstr_upper_lower.go
houseme 94cc233325 fix: disable specific staticcheck rules and update lint config (#4396)
fix: disable specific staticcheck rules and update lint config

- Disabled staticcheck rules SA1029, SA1019, S1000, and related checks
in `.golangci.yml` to filter out unwanted linter errors.
- Updated staticcheck checks list for more precise linting control.
- Clarified configuration for easier maintenance and future updates.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: hailaz <739476267@qq.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-29 10:32:30 +08:00

58 lines
1.5 KiB
Go

// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gstr
import (
"strings"
"golang.org/x/text/cases"
"golang.org/x/text/language"
"github.com/gogf/gf/v2/internal/utils"
)
// ToLower returns a copy of the string s with all Unicode letters mapped to their lower case.
func ToLower(s string) string {
return strings.ToLower(s)
}
// ToUpper returns a copy of the string s with all Unicode letters mapped to their upper case.
func ToUpper(s string) string {
return strings.ToUpper(s)
}
// UcFirst returns a copy of the string s with the first letter mapped to its upper case.
func UcFirst(s string) string {
return utils.UcFirst(s)
}
// LcFirst returns a copy of the string s with the first letter mapped to its lower case.
func LcFirst(s string) string {
if len(s) == 0 {
return s
}
if IsLetterUpper(s[0]) {
return string(s[0]+32) + s[1:]
}
return s
}
// UcWords uppercase the first character of each word in a string.
func UcWords(str string) string {
return cases.Title(language.Und).String(str)
}
// IsLetterLower tests whether the given byte b is in lower case.
func IsLetterLower(b byte) bool {
return utils.IsLetterLower(b)
}
// IsLetterUpper tests whether the given byte b is in upper case.
func IsLetterUpper(b byte) bool {
return utils.IsLetterUpper(b)
}