Sha256: 129e45fc54772bdd0f6920720d78db1882ca5c566f6587bd33bf84788e060f14
Contents?: true
Size: 317 Bytes
Versions: 101
Compression:
Stored size: 317 Bytes
Contents
package acronym import ( "regexp" "strings" ) func Abbreviate(s string) string { regex := regexp.MustCompile("[A-Z]+[a-z]*|[a-z]+") words := regex.FindAllString(s, -1) var abbr []string for _, word := range words { abbr = append(abbr, string(word[0])) } return strings.ToUpper(strings.Join(abbr, "")) }
Version data entries
101 entries across 101 versions & 1 rubygems