4 Star 17 Fork 27

少林码僧 / pkg

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
strutil.go 745 Bytes
一键复制 编辑 原始数据 按行查看 历史
webphp 提交于 2022-09-12 19:21 . add s3
package strutil
import (
"fmt"
"reflect"
"strconv"
"unicode"
"unsafe"
)
func IncludeLetter(str string) bool {
runes := []rune(str)
for _, r := range runes {
if unicode.IsLetter(r) && !unicode.Is(unicode.Scripts["Han"], r) {
fmt.Println("r", r)
return true
}
}
return false
}
func IsDigit(str string) bool {
for _, x := range []rune(str) {
if !unicode.IsDigit(x) {
return false
}
}
return true
}
func Int64ToString(num int64) string {
return strconv.FormatInt(num, 10)
}
func BytesToString(data *[]byte) string {
return *(*string)(unsafe.Pointer(data))
}
func StringToBytes(data string) (b []byte) {
*(*string)(unsafe.Pointer(&b)) = data
(*reflect.SliceHeader)(unsafe.Pointer(&b)).Cap = len(data)
return
}
Go
1
https://gitee.com/phper95/pkg.git
git@gitee.com:phper95/pkg.git
phper95
pkg
pkg
38d933c4cdfa

搜索帮助