摘要:
package main import ( "fmt" "strings" ) func main(){ //返回字符在指定字符串中最后一次出现的位置 last_index := strings.LastIndex("Hello World", "l") fmt.Printf("last_index=%v\n", last_index) /... 阅读全文
摘要:
package main import ( "fmt" "strings" "strconv" ) func main(){ //返回字符串的(字节)长度,相当于PHP的strlen str := "hello世界" //11 ,golang的编码统一为utf-8,字母和数字分别占一个字节,汉子占用3个字节 // str := "hello"... 阅读全文