31 std::reverse(text.begin(), text.end());
34 const static std::regex env(
"\\}([^{]+)\\{\\$(?!\\\\)" );
37 while (std::regex_search(text, match, env))
41 std::string tmp = match[1].str();
42 std::reverse(tmp.begin(), tmp.end());
45 const char * s = std::getenv(tmp.c_str());
47 std::string
var(s == NULL ?
"" : s);
50 std::cout <<
"Environment variable " << match.str() <<
" not set";
53 std::reverse(var.begin(), var.end());
55 text.replace(match[0].first, match[0].second, var);
58 std::reverse(text.begin(), text.end());
64 for (
unsigned int i = 0; i < std::strlen(charsToRemove); ++i)
66 text.erase(std::remove(text.begin(), text.end(), charsToRemove[i]), text.end());
74 static const char* escape_character =
"\\";
75 std::string text = input;
void removeCharsFromString(std::string &text, const char *charsToRemove)
Remove characters in the given string.
Funk var(std::string arg)
std::string expandEnvironmentVariables(const std::string &input)
Leave input alone and return new string, which has environment variables substituted and escpae chara...
void autoExpandEnvironmentVariables(std::string &text)
Expand environment variables in the given string.
Wrapper functionality to get yaml nodes with some extras.
TODO: see if we can use this one: