mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
snip pkg/util/strings dependency
This commit is contained in:
@@ -17,7 +17,6 @@ limitations under the License.
|
||||
package strings
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path"
|
||||
"strings"
|
||||
"unicode"
|
||||
@@ -48,22 +47,6 @@ func ShortenString(str string, n int) string {
|
||||
}
|
||||
}
|
||||
|
||||
// GetArticleForNoun returns the article needed for the given noun.
|
||||
func GetArticleForNoun(noun string, padding string) string {
|
||||
if noun[len(noun)-2:] != "ss" && noun[len(noun)-1:] == "s" {
|
||||
// Plurals don't have an article.
|
||||
// Don't catch words like class
|
||||
return fmt.Sprintf("%v", padding)
|
||||
}
|
||||
|
||||
article := "a"
|
||||
if isVowel(rune(noun[0])) {
|
||||
article = "an"
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s%s%s", padding, article, padding)
|
||||
}
|
||||
|
||||
// isVowel returns true if the rune is a vowel (case insensitive).
|
||||
func isVowel(c rune) bool {
|
||||
vowels := []rune{'a', 'e', 'i', 'o', 'u'}
|
||||
|
||||
Reference in New Issue
Block a user