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