2022-10-27 09:01:05 -04:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-02-02 17:15:17 -08:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
|
|
2022-10-27 09:01:05 -04:00
|
|
|
package template
|
|
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
|
|
|
|
|
// truncateFrom will truncate a string after the first encounter of sep; sep is
|
|
|
|
|
// elided. This is a passthrough to strings.Cut with only the first return
|
|
|
|
|
// value.
|
|
|
|
|
func truncateFrom(str, sep string) string {
|
|
|
|
|
before, _, _ := strings.Cut(str, sep)
|
|
|
|
|
return before
|
|
|
|
|
}
|