Заканчивается ли строка на ...?

Messages
1,679
Reaction score
288
Website
tehadm.ru
C-like:
package main

import (
    "fmt"
    "strings"
)

func main() {
    fmt.Println(solution("abc", "c"))
    fmt.Println(solution("abc", "abc"))

}

func solution(str, ending string) bool {
    return strings.HasSuffix(str, ending)
}
 
Back
Top