Last active
April 5, 2018 08:27
-
-
Save dmitrymomot/bfc2c4f5159ed7249f27303f6501671a to your computer and use it in GitHub Desktop.
Capitalize the first char of a string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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