k.go 185 B

123456789
  1. package kata
  2. // Or just use strings.HasSuffix().
  3. func solution(str, ending string) bool {
  4. if len(ending) > len(str) {
  5. return false
  6. }
  7. return str[len(str)-len(ending):] == ending
  8. }