Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

lib_str.h/lib_str.c

Prototype

Code Block
languagecpp
          CPU_CHAR  *Str_FmtNbr_Int32S (CPU_INT32S    nbr,
                                        CPU_INT08U    nbr_dig,
                                        CPU_INT08U    nbr_base,
                                        CPU_CHAR      lead_char,
                                        CPU_BOOLEAN   lower_case,
                                        CPU_BOOLEAN   nul,
                                        CPU_CHAR     *pstr);


Arguments

nbr

Number to format into a string.

...

Unprintable character

Format invalid string.

 


lower_case

Option to format any alphabetic characters (if any) in lower case:

...

Character array size must be >= (nbr_dig +
1 negative sign +
1 NUL terminator)
characters

Example Usage

Code Block
languagecpp
          CPU_CHAR   AppBuf[20];
          CPU_CHAR  *pstr;


          pstr = Str_FmtNbr_Int32S((CPU_INT32S )-12345678,
                                   (CPU_INT08U ) 10,
                                   (CPU_INT08U ) 10,
                                   (CPU_CHAR   ) '0',
                                   (CPU_BOOLEAN) DEF_NO,
                                   (CPU_BOOLEAN) DEF_YES,
                                   (CPU_CHAR  *)&AppBuf[0]);