Home | History | Annotate | Download | only in strings

Lines Matching full:suffix

414 // HasSuffix tests whether the string s ends with suffix.
415 func HasSuffix(s, suffix string) bool {
416 return len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix
666 // TrimSuffix returns s without the provided trailing suffix string.
667 // If s doesn't end with suffix, s is returned unchanged.
668 func TrimSuffix(s, suffix string) string {
669 if HasSuffix(s, suffix) {
670 return s[:len(s)-len(suffix)]