MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / cleanValueName

Method cleanValueName

src/measure/OSRunner.cpp:1002–1016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1000 }
1001
1002 std::string OSRunner::cleanValueName(const std::string& name) {
1003 static const boost::regex allowableCharacters("[^0-9a-zA-Z]");
1004 static const boost::regex leadingUnderscore("^_+");
1005 static const boost::regex trailingUnderscore("_+$");
1006 static const boost::regex leadingNumber("^([0-9])");
1007 static const boost::regex multipleUnderscore("[_]+");
1008
1009 std::string result = boost::regex_replace(name, allowableCharacters, "_");
1010 result = boost::regex_replace(result, leadingUnderscore, "");
1011 result = boost::regex_replace(result, trailingUnderscore, "");
1012 result = boost::regex_replace(result, leadingNumber, "_$1");
1013 result = boost::regex_replace(result, multipleUnderscore, "_");
1014 result = toUnderscoreCase(result);
1015 return result;
1016 }
1017
1018 void OSRunner::captureStreams() {
1019 if (m_streamsCaptured) {

Callers

nothing calls this directly

Calls 1

toUnderscoreCaseFunction · 0.85

Tested by

no test coverage detected