Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Format NFormat and so on.
Re: Format NFormat and so on. [message #3150 is a reply to message #3147] |
Tue, 09 May 2006 10:52   |
 |
mirek
Messages: 14256 Registered: November 2005
|
Ultimate Member |
|
|
lundman wrote on Tue, 09 May 2006 03:18 |
It's always the trivial things I have to ask for 
|
I do not think this is trivial....
Quote: |
What is the deal with Format and NFormat. I have not really found any documentation giving details to its use. But looking at sources, it seems %` (percent-backtick) prints date/time, but
|
%` is "empty" - default format. In fact, ` can be used as delimiter of format code; the trouble is that unlike classic printf, Format allows you to define your own formats with id's, means you sometimes need delimiter to tell apart id and text..
Quote: |
always in US order. No help for SetDateFormat, and only t.cpp has an example that does not change the format (when used with %`).
%5.2g and %5.2f give me asserts. The docs seem to favour %n instead, and sometimes %5.2n works, but with more than 2 digits in the decimal place, sometimes asserts. %5n seems to work ok, just not the way I was hoping.
|
Not sure where is the problem:
#include <Core/Core.h>
CONSOLE_APP_MAIN
{
LOG(Format("%'", GetSysDate()));
SetLanguage(LNG_('C','S','C','Z'));
LOG(Format("%'", GetSysDate()));
SetLanguage(LNG_('E','N','U','S'));
SetDateFormat("%2:R/%1:d %4:Day");
LOG(Format("%'", GetSysDate()));
LOG(Format("%6.4g", 1.23));
}
.log:
* e:\out\MSC71.Debug_full\Format.exe 09.05.2006 10:47:16, user: cxl
05/09/2006
09.05.2006
V/2006 Tuesday
1.23
If troubles persist, send the code!
Quote: |
What is the difference between NFormat and Format? The examples seem to use both.
|
They are the same. You should use straight Format.
(Two names are just some echoes of the past - originally, Format behaved like Sprintf, using C standard library. Then we decided to extend it for any Values and new was named NFormat to keep BWC while deprecating Format. When our code was Format clean, we hijacked Format for NFormat behaviour. Happened 2 years ago anyway 
Mirek
|
|
|
Goto Forum:
Current Time: Wed Apr 30 01:49:18 CEST 2025
Total time taken to generate the page: 0.04303 seconds
|