summaryrefslogtreecommitdiff
path: root/go/acronym/acronym.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/acronym/acronym.go')
-rw-r--r--go/acronym/acronym.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/go/acronym/acronym.go b/go/acronym/acronym.go
new file mode 100644
index 0000000..2752fd1
--- /dev/null
+++ b/go/acronym/acronym.go
@@ -0,0 +1,23 @@
+package acronym
+
+import (
+ "bytes"
+ "strings"
+ "unicode"
+)
+
+const testVersion = 1
+
+func abbreviate(s string) string {
+ buf := new(bytes.Buffer)
+ for i, v := range strings.Title(s) {
+ if i > 0 && unicode.IsUpper(rune(s[i-1])) {
+ continue
+ }
+ if unicode.IsUpper(v) {
+ buf.WriteRune(v)
+ }
+
+ }
+ return buf.String()
+}