Return Type | Function name | Arguments |
---|---|---|
const char* | FormalMoney | (int,) |
Declared in file: hzTextproc.h
Defined in file : hzTextproc.cpp
Function Logic:
Function body:
const char* FormalMoney (int nValue) { _hzfunc("FormalMoney") ; char* i ; char* pBuf ; uint32_t M ; uint32_t T ; uint32_t U ; uint32_t C ; uint32_t pad ; i = pBuf = _thisfn.ScratchPad(16); i[0]= CHAR_SPACE ; if (nValue < 0) { i[0]= CHAR_MINUS ; nValue *= -1; } M = (nValue / 100000000); T = (nValue % 100000000)/100000; U = (nValue % 100000)/100; C = (nValue % 100); if (M > 9) pad = 0; else if (M) pad = 1; else if (T > 99)pad = 3; else if (T > 9) pad = 4; else if (T) pad = 5; else if (U > 99)pad = 7; else if (U > 9) pad = 8; else pad = 9; for (i++ ; pad > 0; pad--) *i++ = CHAR_SPACE ; if (M) sprintf(i, "%d,%03d,%03d.%02d", M, T, U, C) ; else if (T) sprintf(i, "%d,%03d.%02d", T, U, C) ; else if (U) sprintf(i, "%d.%02d", U, C) ; else sprintf(i, "0.%02d", C) ; return pBuf ; }