CHAR LPAD()
From Recital Documentation Wiki
PURPOSE
Pad out a character string to the defined length from the left
SYNONYM
api_char_lpad()
SYNOPSIS
#include "dbapi.h" char CHAR_LPAD(buffer, string, len, padch) <input parameters> char *string; /* Address of a buffer containing character string */ int len; /* Total length of the returned string */ char padch; /* Character to pad with */ <output parameters> char *buffer; /*Address of the buffer where the result is returned */
DESCRIPTION
The CHAR_LPAD() function right justifies a character string and pads out the left of the string, to the total length specified with the specified pad character.
EXAMPLE
The following example pads the left of the first parameter passed to the total length specified by the second parameter with the character passed in the third parameter.
#include "dbapi.h" dbapi_char_lpad() { char buffer[1025] if (_parinfo(1) == API_CTYPE && _parinfo(2) == API_NTYPE && _parinfo(3) == API_CTYPE) { CHAR_LPAD( buffer, _parc(1), _parni(2), _parc(3) ); } else { strcpy(buffer,""); } _retc( buffer ); }
SEE ALSO
_parc(), _parclen(), _parcsiz(), _parinfo(), _retc(), _retclen(), ISCHAR(), CHAR_ALLTRIM(), CHAR_LOWER(), CHAR_LTRIM(), CHAR_RPAD(), CHAR_RTRIM(), CHAR_STR(), CHAR_UPPER(), DATE_STOD()