mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: improvements to stringOps format and split functions
- split now optionally retains empty substrings. Added split on fixed field width. - Foam::name() now formats directly into string buffer, which a removes one layer of copying and also avoids using a non-constexpr in the temporary. STYLE: explicit type narrowing on zero-padded output for ensight
This commit is contained in:
@ -62,6 +62,18 @@ int main(int argc, char *argv[])
|
||||
dict.add("FOAM_RUN", subDict);
|
||||
|
||||
|
||||
// Test Foam::name with formatting string
|
||||
{
|
||||
word formatted = Foam::name("formatted=<%X>", 0xdeadbeef);
|
||||
Info<<"formatted: " << formatted << nl;
|
||||
}
|
||||
|
||||
Info<<"formatted: "
|
||||
<< Foam::name("formatted not checked for validity=<%X>", 0xdeadbeef)
|
||||
<< nl
|
||||
<< endl
|
||||
|
||||
|
||||
Info<< "string:" << test << nl << "hash:"
|
||||
<< unsigned(string::hash()(test)) << endl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user