MCPcopy Create free account
hub / github.com/crawl/crawl / lowercase_string

Function lowercase_string

crawl-ref/source/stringutil.cc:42–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40
41
42string lowercase_string(const string &s)
43{
44 string res;
45 char32_t c;
46 char buf[4];
47 for (const char *tp = s.c_str(); int len = utf8towc(&c, tp); tp += len)
48 {
49 // crawl breaks horribly if this is allowed to affect ascii chars,
50 // so override locale-specific casing for ascii. (For example, in
51 // Turkish; tr_TR.utf8 lowercase I is a dotless i that is not
52 // ascii, which breaks many things.)
53 if (isaalpha(tp[0]))
54 res.append(1, toalower(tp[0]));
55 else
56 res.append(buf, wctoutf8(buf, towlower(c)));
57 }
58 return res;
59}
60
61string &lowercase(string &s)
62{

Callers 15

parse_mons_spellsMethod · 0.85
_beast_facet_by_nameFunction · 0.85
_mutant_beast_xlFunction · 0.85
find_job_from_stringFunction · 0.85
artp_type_from_nameFunction · 0.85
str_to_skillFunction · 0.85
skill_title_by_rankFunction · 0.85
crawl_versionFunction · 0.85

Calls 4

isaalphaFunction · 0.85
wctoutf8Function · 0.85
toalowerFunction · 0.70
appendMethod · 0.45

Tested by 2

from_str_looseFunction · 0.68
from_abbrevFunction · 0.68