ToUpperFirst returns s with only the first Unicode letter mapped to its upper case.
(s string)
| 8 | |
| 9 | // ToUpperFirst returns s with only the first Unicode letter mapped to its upper case. |
| 10 | func ToUpperFirst(s string) string { |
| 11 | for i, v := range s { |
| 12 | return string(unicode.ToUpper(v)) + s[i+1:] |
| 13 | } |
| 14 | return "" |
| 15 | } |
| 16 | |
| 17 | // RandomChars returns a generated string in given number of random characters. |
| 18 | func RandomChars(n int) (string, error) { |