Class | Purpose |
---|---|
StringFormat | Formats a data field as a string and unformats a string into a data
field object. StringFormat is the simplest field formatter. You can set attributes
so that the formatter returns the string with all upper case letters, all
lower case letters, or unchanged.
For example, a StringFormat has the
following attributes set:
|
IntegerFormat | Formats and unformats an integer from one to eight bytes in size. The
unformat method updates the data field's value with a:
|
BinaryIntegerString Format | Formats and unformats a string of number characters. When unformatting,
this formatter returns the string's binary representation in a chain of bytes.
You
can set attributes so that the formatter returns the data field with big-endian
(host) or little-endian (PC) byte ordering.
For example, a BinaryIntegerStringFormat
has the following attributes set:
|
NumericStringFormat | Formats and unformats a string of number characters.
You can
set attributes so that the formatter returns the data field with or without
decimals, with or without a thousands separator, and with or without sign
representation. You can also specify the number of decimal places and the
characters to use for decimal separation, the thousands separator, and the
sign representation.
For example, a NumericStringFormat has the following
attributes set:
|
PackedFormat | Formats integers or floats into a one byte string representation and
unformats a one byte string representation into a two byte integer or float.
You
can set an attribute to specify the number of decimal places. For example,
a PackedFormat has the following attributes set:
|
PackedDateFormat | Formats a Date object into a one byte string representation and unformats a one byte string representation into a two byte Date object. For example, a PackedDateFormat formats a data field with a Date object value of: Fri Apr 24 10:00:00 GMT+03:00 1998 The format method returns the following string: "240498" (hexadecimal values) If you unformat the string, the data field has the following value: Fri Apr 24 10:00:00 GMT+03:00 1998 |
FloatFormat | Formats and unformats a floating point number. The size of its representation
is float (4 bytes) or double precision (8 bytes).
You can set attributes
so that the formatter returns the data field with big-endian (host) or little-endian
(PC) byte ordering.
For example, a FloatFormat has the following attributes
set:
|
DateFormat | Formats or unformats a Date object.
You can set attributes so
that the formatter returns the data field with or without a separator, the
year with either two or four digits, and a specific day-month-year ordering.
You can also specify the separator character.
For example, a DateFormat
has the following attributes set:
|
TimeFormat | Formats or unformats a time in the Date object.
You can set
attributes so the formatter returns the data field with or without a separator,
return the time in 12 or 24 hour format, and return the time with or without
seconds. You can also specify the separator character and the strings to represent
AM and PM.
For example, a DateFormat has the following attributes set:
|
These formatter classes may apply decorators to the formatted strings.