mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 12:44:10 -06:00
27 lines
489 B
Go
27 lines
489 B
Go
package cloudmonitoring
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
func reverse(s string) string {
|
|
chars := []rune(s)
|
|
for i, j := 0, len(chars)-1; i < j; i, j = i+1, j-1 {
|
|
chars[i], chars[j] = chars[j], chars[i]
|
|
}
|
|
return string(chars)
|
|
}
|
|
|
|
func toSnakeCase(str string) string {
|
|
return strings.ToLower(matchAllCap.ReplaceAllString(str, "${1}_${2}"))
|
|
}
|
|
|
|
func containsLabel(labels []string, newLabel string) bool {
|
|
for _, val := range labels {
|
|
if val == newLabel {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|