You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	s := "123"
	n, err := strconv.Atoi(s)
	if err != nil {
		fmt.Println("转换出错了")
	} else {
		fmt.Println(n)
	}

	s2 := "abc21313abc3456abc3131zhengyuabc"
	m := strings.Count(s2, "1")
	fmt.Printf("1的出现次数是%d\n",m)
	fmt.Println(strings.Index(s2,"1"))

	fmt.Println(strings.EqualFold("HeLLo", "hello"))
	fmt.Println("HeLLo" == "hello")
}

  • No labels