vendredi 20 janvier 2012

StrFmt Function [AX 2012]

static void strFmtExampleJob(Args _arg)
{
System.Double sysDouble;
real r = 8.3456789;
int i = 42;
utcDateTime utc = str2DateTime
("2008-01-16 13:44:55" ,321); // 321 == YMD.
str s;
;
s = strFmt("real = %1, int = %2, utcDateTime = %3, [%4]"
, r, i, utc);
info("X1: " + s);
//
sysDouble = r;
s = System.String::Format("{0:##.####}", sysDouble);
info("N1: " + s);
//
s = System.String::Format("{0,6:C}", sysDouble); // $
info("N2: " + s);
/********** Actual Infolog output
Message (02:16:05 pm)
X1: real = 8.35, int = 42, utcDateTime = 1/16/2008 01:44:55 pm, [%4]
N1: 8.3457
N2: $8.35
**********/
}

Aucun commentaire:

Enregistrer un commentaire