mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: provide word::validated() static method
- Constructs a validated word, in which all invalid characters have been stripped out and any leading digit is '_'-prefixed. Words with leading digits cause parse issues when read back later. - Replaces previous functionally identical code from src/conversion -- COMP: test against nullObject instead of checking address for null pointer.
This commit is contained in:
@ -69,6 +69,13 @@ int main(int argc, char *argv[])
|
||||
Info<<"trimRight: " << stringOps::trimRight(test) << endl;
|
||||
Info<<"trim: " << stringOps::trim(test) << endl;
|
||||
|
||||
Info<< nl;
|
||||
Info<<"camel-case => " << (word("camel") & "case") << nl;
|
||||
for (const auto& s : { " text with \"spaces'", "08/15 value" })
|
||||
{
|
||||
Info<<"validated \"" << s << "\" => " << word::validated(s) << nl;
|
||||
}
|
||||
Info<< nl;
|
||||
|
||||
// test sub-strings via iterators
|
||||
string::const_iterator iter = test.end();
|
||||
|
||||
Reference in New Issue
Block a user