aboutsummaryrefslogtreecommitdiff
path: root/strings.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2021-11-03 19:14:19 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2021-11-03 19:14:19 -0400
commit936dcbc7b1a23ec8a2a825af0307b5db95e3e6d0 (patch)
treee1773e794e9f56709f3152fa9470b9552545e902 /strings.c
parentce48be18ff6d36326521cfb28eea203c562f391c (diff)
downloadjdtalkc-936dcbc7b1a23ec8a2a825af0307b5db95e3e6d0.tar.gz
Add usage statement and title case converter
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;
+}