CharArray
stores fixed length
strings, it displays variable length strings. This is a result of the
stripping and padding policies of the CharArray class.
When an element of a CharArray
is fetched trailing whitespace is
stripped off. The sole exception to this rule is that a single whitespace is
never stripped down to the empty string. numarray.strings
defines
whitespace as an ASCII space, formfeed, newline, carriage return, tab, or
vertical tab.
When a string is assigned to a CharArray
, the string is considered
terminated by the first of any NULL characters it contains and is padded with
spaces to the full length of the CharArray
itemsize. Thus, the memory
image of a CharArray
element does not include anything at or after the
first NULL in an assigned string; instead, there are spaces, and no terminating
NULL character at all.
When a string which is longer than the itemsize()
is assigned to a
CharArray
, it is silently truncated.
The RawCharArray
baseclass of CharArray
implements transparent
strip()
and pad()
methods, enabling the storage and retrieval of
arbitrary ASCII values within array elements. For RawCharArray
, all
array elements are identical in percieved length. Alternate
stripping and padding policies can be implemented by subclassing
CharArray
or RawCharArray
.
Send comments to the NumArray community.