MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / FindDelimiter

Function FindDelimiter

wrappers/MathCAD/CoolPropMathcad.cpp:170–185  ·  view source on GitHub ↗

Helper: Determine which of the valid delimiters were passed in a String.

Source from the content-addressed store, hash-verified

168
169// Helper: Determine which of the valid delimiters were passed in a String.
170static 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

Callers 1

CP_PropsSImultiFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected