升级字符串操作

This commit is contained in:
zhangdeman committed 2022-05-14 15:11:45 +08:00
1 parent 5c78dd1201
commit 8d84b733b8
2 files changed
+14 -3

No files matched your search

+3
View File
@@ -18,6 +18,8 @@ var (
IP *ip
// JSON ...
JSON *ownJSON
// String ...
String *stringOperate
)
func init() {
@@ -26,4 +28,5 @@ func init() {
Hash = &hash{}
IP = &ip{}
JSON = &ownJSON{}
String = &stringOperate{}
}
+11 -3
View File
@@ -15,12 +15,20 @@ import (
"time"
)
// stringOperate ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:09 2022/5/14
type stringOperate struct {
}
// GenRandomString 获取随机长度的字符串
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 6:01 下午 2021/3/9
func GenRandomString(source string, length uint) string {
func (s *stringOperate) GenRandomString(source string, length uint) string {
if length == 0 {
return ""
}
@@ -42,7 +50,7 @@ func GenRandomString(source string, length uint) string {
// Author : go_developer@163.com<白茶清欢>
//
// Date : 6:01 下午 2021/3/9
func Md5(str string) string {
func (s *stringOperate) Md5(str string) string {
h := md5.New()
_, _ = h.Write([]byte(str))
return hex.EncodeToString(h.Sum(nil))
@@ -53,7 +61,7 @@ func Md5(str string) string {
// Author : go_developer@163.com<白茶清欢>
//
// Date : 4:58 下午 2021/10/25
func SnakeCaseToCamel(str string) string {
func (s *stringOperate) SnakeCaseToCamel(str string) string {
if len(str) == 0 {
return ""
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.