aboutsummaryrefslogtreecommitdiff
path: root/strings.c
diff options
context:
space:
mode:
Diffstat (limited to 'strings.c')
-rw-r--r--strings.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/strings.c b/strings.c
index a7a6dda..7250d69 100644
--- a/strings.c
+++ b/strings.c
@@ -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;
+}