category-group: strings
layer: 1
header file(s): z_string.h
libraries: libz00.lib libz01.lib synopsis.
the few string functions found here at layer 1 relate to numeric conversion. Their categorization into 'strings' instead of 'math' was a close call. [C] functions (aka subroutines):
z_str_to_int_wbase()
SIGNATURE: count_t z_str_to_int_wbase (const char *buf, int base, int *pi)
SYNOPSIS:
calculate a number, contained as a string representation of a number in the character array "buf", as an integral number whose base is given by the value "base":
int ie, x; x = z_str_to_int_wbase ("1A", 16, &ie); // CASE 1 x = z_str_to_int_wbase ("0110", 2, &ie); // CASE 2This will return a value of 26 into x in the first case, and 6 in the second case.
TRAITS: There needs to be more [syntax] error checking; 'z_str_to_int_wbase("9A", 8)' might slide thru undetected.
z_numstr()
SIGNATURE: string_o z_numstr (count_t n, int flags)
SYNOPSIS: converts a cardinal (countable; count_t) number into a string object
PARAMETERSRETURNS: a string object, containing a text representation of the value
- n: [input] the number to format as a string
- flags: [input] unused
z_realstr()
SIGNATURE: string_o z_realstr (double d, int flags)
SYNOPSIS: converts a variable-precision (floating-point, eg double) number into a string object
PARAMETERSRETURNS: a string object, containing a text representation of the floating-point (double) value
- d: [input] the number to format-print as a string
- flags: [input] unused