17 lines
442 B
Go
17 lines
442 B
Go
// Package utils 提供通用工具函数
|
|
// 包含字符串处理、格式化等常用功能
|
|
package utils
|
|
|
|
import "strings"
|
|
|
|
// FormatKey 格式化键值
|
|
// 移除空格,转换为小写,确保键值的唯一性和一致性
|
|
// 参数:
|
|
// - key: 原始键值
|
|
// 返回:
|
|
// - 格式化后的键值
|
|
func FormatKey(key string) string {
|
|
// 移除所有空格并转换为小写
|
|
return strings.ToLower(strings.ReplaceAll(key, " ", ""))
|
|
}
|