Go的字符串遍历,有两种方式: utf-8遍历unicode遍历 package main import "fmt" func main() { str := "Hello,世界" fmt.Println("Utf-8遍历") for i := 0; i < len(str); i++ { ch := str[i] fmt.Println(ch) } fmt.Println("Unicode遍历") for _, ch1...
Category - goframe
goframe是go语言的一种国内开源的框架
go实现获取图片文件的扩展名
package common import ( "fmt" "os" ) func GetImgExt(file string) (ext string, err error) { var headerByte []byte headerByte = make([]byte, 8) fd, err := os.Open(file) if err != nil { return "", err } defer fd...