Mark Olesen
cae7ce37f5
ENH: provide formatting version of Foam::name() (issue #253 )
...
- there are some cases in which the C-style sprintf is much more
convenient, albeit problematic for buffer overwrites.
Provide a formatting version of Foam::name() for language
primitives that is buffer-safe.
Returns a Foam::word, so that further output will be unquoted, but
without any checking that the characters are indeed entirely valid
word characters.
Example use,
i = 1234;
s = Foam::name("%08d", i);
produces '00001234'
Alternative using string streams:
std::ostringstream buf;
buf.fill('0');
buf << setw(8) << i;
s = buf.str();
Note that the format specification can also be slightly more complex:
Foam::name("output%08d.vtk", i);
Foam::name("timing=%.2fs", time);
It remains the caller's responsibility to ensure that the format mask
is valid.
2016-07-01 08:23:13 +02:00
..
2010-11-23 16:26:04 +01:00
2013-03-13 09:45:16 +00:00
2016-07-28 07:00:33 +02:00
2015-07-16 14:37:19 +01:00
2015-08-06 16:54:47 +01:00
2016-07-15 09:05:44 +02:00
2015-02-10 20:35:50 +00:00
2016-04-03 10:26:05 +01:00
2016-06-15 12:38:46 +02:00
2016-06-16 08:22:53 +02:00
2015-07-16 14:37:19 +01:00
2011-08-14 12:17:30 +01:00
2016-06-09 18:33:56 +01:00
2011-08-14 12:17:30 +01:00
2013-07-04 10:00:44 +01:00
2016-01-10 19:20:16 +00:00
2012-01-11 09:48:45 +00:00
2011-08-14 12:17:30 +01:00
2012-12-11 16:38:39 +00:00
2016-01-10 22:41:16 +00:00
2016-06-07 17:16:09 +01:00
2011-08-14 12:17:30 +01:00
2015-11-11 09:03:39 +00:00
2016-04-25 10:28:32 +01:00
2010-11-23 16:26:04 +01:00
2011-08-14 12:17:30 +01:00
2016-09-20 14:49:08 +01:00
2016-09-20 14:49:08 +01:00
2011-08-14 12:17:30 +01:00
2015-02-25 10:57:06 +00:00
2015-02-10 20:35:50 +00:00
2015-02-10 20:35:50 +00:00
2016-08-11 22:02:05 +01:00
2011-08-14 12:17:30 +01:00
2016-04-25 11:40:48 +01:00
2015-07-16 14:37:19 +01:00
2016-09-26 10:57:34 +01:00
2013-01-17 11:06:38 +00:00
2016-04-30 21:40:09 +01:00
2016-04-25 12:00:53 +01:00
2016-05-18 21:20:42 +01:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2016-04-25 11:40:48 +01:00
2016-08-05 17:19:38 +01:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2016-08-11 21:41:55 +01:00
2016-08-05 22:30:26 +01:00
2016-01-10 22:41:16 +00:00
2016-09-20 14:49:08 +01:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2016-08-09 20:36:32 +01:00
2016-02-08 16:33:56 +00:00
2011-08-14 12:17:30 +01:00
2016-04-30 21:40:09 +01:00
2016-07-17 14:44:50 +01:00
2011-06-08 15:37:11 +01:00
2011-08-14 12:17:30 +01:00
2016-04-24 22:07:37 +01:00
2011-08-14 12:17:30 +01:00
2016-04-25 10:28:32 +01:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2014-12-15 22:38:10 +00:00
2016-03-20 19:44:29 +00:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2016-02-08 16:30:00 +00:00
2016-01-10 22:41:16 +00:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2016-06-02 09:45:04 +02:00
2015-02-10 20:35:50 +00:00
2016-04-25 12:00:53 +01:00
2016-04-16 18:34:41 +01:00
2016-04-25 10:28:32 +01:00
2016-09-20 14:49:08 +01:00
2016-05-18 21:20:42 +01:00
2016-05-18 21:20:42 +01:00
2016-04-16 18:34:41 +01:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2016-05-18 21:20:42 +01:00
2011-08-14 12:17:30 +01:00
2013-09-25 10:11:36 +01:00
2015-09-16 21:26:26 +01:00
2016-04-16 15:59:05 +01:00
2015-07-16 14:37:19 +01:00
2016-09-20 14:49:08 +01:00
2016-04-17 15:47:03 +01:00
2016-09-20 14:49:08 +01:00
2015-02-04 16:33:02 +00:00
2016-03-20 19:44:29 +00:00
2011-08-14 12:17:30 +01:00
2015-07-16 14:37:19 +01:00
2016-08-12 10:01:41 +01:00
2013-09-25 10:11:36 +01:00
2015-06-30 10:26:44 +01:00
2011-08-14 12:17:30 +01:00
2015-12-22 23:14:17 +00:00
2011-08-14 12:17:30 +01:00
2016-07-01 08:23:13 +02:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2016-05-18 21:20:42 +01:00
2016-06-15 20:17:44 +02:00
2016-03-04 11:30:13 +00:00
2012-02-01 12:30:16 +00:00
2015-11-10 17:53:31 +00:00
2016-01-10 22:41:16 +00:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2010-11-23 16:26:04 +01:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2011-08-14 12:17:30 +01:00
2013-09-27 22:47:59 +01:00
2010-11-23 16:26:04 +01:00
2015-02-04 16:32:36 +00:00
2016-09-20 14:49:08 +01:00
2016-04-24 22:07:37 +01:00
2016-05-18 21:20:42 +01:00
2016-04-25 11:40:48 +01:00
2016-01-10 22:41:16 +00:00