MCPcopy Index your code
hub / github.com/NetHack/NetHack / upwords

Function upwords

src/hacklib.c:122–138  ·  view source on GitHub ↗

capitalize first letter of every word in a string (in place) */

Source from the content-addressed store, hash-verified

120
121/* capitalize first letter of every word in a string (in place) */
122char *
123upwords(char *s)
124{
125 char *p;
126 boolean space = TRUE;
127
128 for (p = s; *p; p++)
129 if (*p == ' ') {
130 space = TRUE;
131 } else if (space && letter(*p)) {
132 *p = highc(*p);
133 space = FALSE;
134 } else {
135 space = FALSE;
136 }
137 return s;
138}
139
140/* remove excess whitespace from a string buffer (in place) */
141char *

Callers 1

doreadFunction · 0.85

Calls 2

letterFunction · 0.85
highcFunction · 0.85

Tested by

no test coverage detected