Convert to lowercase, except for inside strings
| 71 | |
| 72 | // Convert to lowercase, except for inside strings |
| 73 | const 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 | |
| 89 | BoutReal stringToReal(const std::string& s) { |
| 90 | std::stringstream ss(s); |