Helper: Determine which of the valid delimiters were passed in a String.
| 168 | |
| 169 | // Helper: Determine which of the valid delimiters were passed in a String. |
| 170 | static inline char FindDelimiter(std::string instr) { |
| 171 | unsigned int nDelims = 0; // Delimiter count |
| 172 | static char dType = '\0'; // Initialize to 'null' character, which will be returned if no delimiters are found. |
| 173 | static const char dels[] = {' ', ',', '&', ';', '|'}; // Valid delimiters list |
| 174 | |
| 175 | for (char d : dels) { // Loop through valid delimiters |
| 176 | if (instr.find(d) != std::string::npos) { // If found |
| 177 | nDelims++; // increment |
| 178 | dType = d; // and save the delimiter type |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | if (nDelims > 1) dType = 'E'; // Multiple delimiters found, return 'null'E' character to trigger error |
| 183 | |
| 184 | return dType; // Return the delimiter type found, or '\0' if none, or 'E' if multiple |
| 185 | } |
| 186 | |
| 187 | // This code executes the user function CP_get_global_param_string, which is a wrapper for |
| 188 | // the CoolProp.get_global_param_string() function, used to get a global string parameter from CoolProp |