Title makes first letter of each word of user input to uppercase it can be chained on function which return StringManipulation interface
()
| 362 | // Title makes first letter of each word of user input to uppercase |
| 363 | // it can be chained on function which return StringManipulation interface |
| 364 | func (i *input) Title() (result string) { |
| 365 | input := getInput(*i) |
| 366 | wordArray := strings.Split(input, " ") |
| 367 | for i, word := range wordArray { |
| 368 | wordArray[i] = strings.ToUpper(string(word[0])) + strings.ToLower(word[1:]) |
| 369 | } |
| 370 | return strings.Join(wordArray, " ") |
| 371 | } |
| 372 | |
| 373 | // ToUpper makes all string of user input to uppercase |
| 374 | // it can be chained on function which return StringManipulation interface |