MCPcopy Create free account
hub / github.com/DFHack/dfhack / capitalize

Method capitalize

library/modules/Translation.cpp:83–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83std::string Translation::capitalize(const std::string &str, bool all_words)
84{
85 string upper = str;
86
87 if (!upper.empty())
88 {
89 upper[0] = toupper(upper[0]);
90
91 if (all_words)
92 {
93 for (size_t i = 1; i < upper.size(); i++)
94 if (isspace(upper[i-1]))
95 upper[i] = toupper(upper[i]);
96 }
97 }
98
99 return upper;
100}
101
102void addNameWord (string &out, const string &word)
103{

Callers

nothing calls this directly

Calls 3

toupperFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected