User Tools

Site Tools

한국어

logicpython:cubloc_api:hexn

This is an old revision of the document!


HexN

Hex formatting variants: Hex and Hex1 through Hex8.

Syntax

from cubloc import HexN
 
# Natural width
Hex(value: int)
 
# Fixed width
Hex1(value: int) ... Hex8(value: int)

Parameters

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

Return Value

Returns the formatted uppercase hexadecimal string using either natural width (Hex) or fixed-width right-justified text (Hex1 through Hex8).

Notes

  • Hex(value) returns natural-width uppercase hexadecimal text.
  • Hex1..Hex8 return right-justified uppercase hexadecimal text in fixed-width fields.

Example

from cubloc import Hex, Hex2, Hex8
 
# Use Hex for natural width, or HexN variants for fixed width.
value = 255
print(Hex(value))     # e.g. FF
print(Hex2(value))    # e.g. 'FF'
print(Hex8(value))    # e.g. '      FF'
logicpython/cubloc_api/hexn.1775786798.txt.gz · Last modified: by 127.0.0.1