User Tools

Site Tools

한국어

logicpython:cubloc_api:decn

This is an old revision of the document!


DecN

Decimal formatting variants: Dec and Dec1 through Dec11.

Syntax

from cubloc import DecN
 
# Natural width
Dec(value: int)
 
# Fixed width
Dec1(value: int) ... Dec11(value: int)

Parameters

  • value: Integer value to format.
  • digits: Field width for DecN variants. Use 0 for natural width (Dec).

Return Value

Returns the formatted decimal string using either natural width (Dec) or fixed-width right-justified text (Dec1 through Dec11).

Notes

  • Dec(value) returns natural-width decimal text.
  • Dec1..Dec11 return right-justified decimal text in fixed-width fields.

Example

from cubloc import Dec, Dec4, Dec8
 
# Use Dec for natural width, or DecN variants for fixed width.
value = 42
print(Dec(value))     # e.g. 42
print(Dec4(value))    # e.g. '  42'
print(Dec8(value))    # e.g. '      42'
logicpython/cubloc_api/decn.1775786798.txt.gz · Last modified: by 127.0.0.1