Skip to content

Instantly share code, notes, and snippets.

@dmitrymomot
Last active April 5, 2018 08:27
Show Gist options
  • Select an option

  • Save dmitrymomot/bfc2c4f5159ed7249f27303f6501671a to your computer and use it in GitHub Desktop.

Select an option

Save dmitrymomot/bfc2c4f5159ed7249f27303f6501671a to your computer and use it in GitHub Desktop.
Capitalize the first char of a string
package helper
import (
"fmt"
"unicode"
)
func CapitalizeFirstChar(s string) string {
a := []rune(s)
a[0] = unicode.ToUpper(a[0])
s = string(a)
return s
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment