MCPcopy Create free account
hub / github.com/boutproject/BOUT-dev / lowercasequote

Function lowercasequote

src/sys/utils.cxx:73–87  ·  view source on GitHub ↗

Convert to lowercase, except for inside strings

Source from the content-addressed store, hash-verified

71
72// Convert to lowercase, except for inside strings
73const std::string lowercasequote(const std::string& str) {
74 std::string strlow(str);
75
76 bool quote = false, dquote = false;
77 for (char& i : strlow) {
78 if (i == '\'') {
79 quote ^= true;
80 } else if (i == '"') {
81 dquote ^= true;
82 } else if ((!quote) && (!dquote)) {
83 i = static_cast<char>(tolower(i));
84 }
85 }
86 return strlow;
87}
88
89BoutReal stringToReal(const std::string& s) {
90 std::stringstream ss(s);

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68