HasSuffix

HasSuffix判断s是否有后缀字符串suffix。

HasSuffix

函数定义

func HasSuffix(s, suffix string) bool

代码示例

package main

import (
    "fmt"
    "strings"
)

func main() {
    fmt.Println(strings.HasSuffix("Amigo", "go")) //true
    fmt.Println(strings.HasSuffix("Amigo", "O")) //false
    fmt.Println(strings.HasSuffix("Amigo", "Ami")) //false
    fmt.Println(strings.HasSuffix("Amigo", "")) //true
}