Skip to content
Snippets Groups Projects
Commit 596430d3 authored by mattijs's avatar mattijs
Browse files

ENH: string: allow empty string substitution in expand

parent 6d0c6483
Branches
Tags
No related merge requests found
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -94,7 +94,7 @@ Foam::string& Foam::string::replaceAll
// Expand all occurences of environment variables and initial tilde sequences
Foam::string& Foam::string::expand(const bool recurse)
Foam::string& Foam::string::expand(const bool recurse, const bool allowEmptyVar)
{
size_type startEnvar = 0;
......@@ -152,11 +152,13 @@ Foam::string& Foam::string::expand(const bool recurse)
);
startEnvar += enVarString.size();
}
else if (allowEmptyVar)
{
startEnvar = endEnvar;
}
else
{
//startEnvar = endEnvar;
FatalErrorIn("string::expand()")
FatalErrorIn("string::expand(const bool, const bool)")
<< "Unknown variable name " << enVar << '.'
<< exit(FatalError);
}
......
......@@ -182,7 +182,11 @@ public:
//
// \sa
// Foam::findEtcFile
string& expand(const bool recurse=false);
string& expand
(
const bool recurse=false,
const bool allowEmptyVar = false
);
//- Remove repeated characters returning true if string changed
bool removeRepeated(const char);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment