diff options
Diffstat (limited to 'strings.c')
-rw-r--r-- | strings.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -141,3 +141,19 @@ char *str_leet(char *s) { return buf; } +char *str_title_case(char *s) { + size_t len; + size_t i; + + len = strlen(s); + i = 0; + char ch; + + s[i] = toupper(s[i]); + for (; i < len; i++) { + if (i < len - 1 && s[i] == ' ') { + s[i + 1] = (char) toupper(s[i + 1]); + } + } + return s; +} |